Skip to content

some feature requests #61

@TrueMyst

Description

@TrueMyst

I've been using PicText for quite a while now, and I have to say it's an excellent tool that fits my use case perfectly. However, there are a few features that I believe would be nice addition to this tool.

Auto Text Resizing

It would be great if text could automatically resize when it exceeds the maximum width or height of its text box. The font size could be gradually reduced until the text fits within the available space, with automatic wrapping applied to maintain readability.

At the moment, I have to rely on a custom function written in Pillow to achieve this behavior. While it works, it's not efficient. Converting everything to Pillow just to draw text that can automatically resize feels unnecessary and adds extra complexity.

I would love to see native support for automatic text resizing in PicText in the future.

Pillow-Style Text Anchors

The anchor system in PicText is flexible, but it differs quite a bit from Pillow's implementation. One feature I miss is coordinate-based anchors.

Ideally, it would be possible to position elements using something like:

.place(x, y, anchor)

with anchor values such as:

lt, mt, rt,
lm, mm, rm,
lb, mb, rb

where:

  • l, m, r represent left, middle, and right alignment.
  • t, m, b represent top, middle, and bottom alignment.

This would be much more intuitive than manually calculating and passing x_offset and y_offset values, which can become tedious and inefficient.

To work around this limitation, I currently use a helper function that somewhat does the job.

# Calculate coordinates based on the provided anchor
def calculate_coords(
    self,
    canvas_size: tuple,
    xy: tuple,
    anchor: Literal["lt", "rt", "lb", "rb"] = "lt",
) -> tuple:
    # I don't need "m" for my case but it would be nice to have it
    ANCHOR_X = {"l": "left", "r": "right"}
    ANCHOR_Y = {"t": "top", "b": "bottom"}

    x, y = xy
    canvas_w, canvas_h = canvas_size

    h, v = anchor[0], anchor[1]  # horizontal, vertical

    return (
        ANCHOR_X[h],
        ANCHOR_Y[v],
        x if h == "l" else x - canvas_w,
        y if v == "t" else y - canvas_h,
    )

Converting Pillow Images to PicText.Image

This is a relatively small feature request, but I think it would be a great addition as well.

I primarily use PicText for text rendering because of its excellent multi-font support. I usually complete all text-related work in PicText, convert the result to a Pillow image, apply various Pillow effects to another image, and then paste it back onto the final canvas.

Since Pillow provides a wide range of useful image-processing capabilities that I frequently rely on, it would be incredibly convenient to have a method that converts a Pillow image directly into a PicText.Image object so that I can render it on the canvas easily :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions