Skip to content

Feature Request: Dithered Images #3

@timfi

Description

@timfi

Description

An amazing feature would be the ability to render a given image onto a dotmatrix. And to make things prettier some sort of dithering, be it Floyd-Steinberg or Atkinson or something else entirely, would also be nice.

Code

import dotmatrix as dm

m = dm.Matrix(256, 256)

m.blit(
    "path/to/my/image",
    area=((63, 63), (191, 191)),  # The area to blit the image to.
    dither=dm.dither.Floyd        # The dithering algorithm to use.
)

print(m.render())

or

import dotmatrix as dm
from PIL import Image


m = dm.Matrix(256, 256)
img = Image.open("path/to/my/image")

m.blit(
    img,
    area=((63, 63), (191, 191)),  # The area to blit the image to.
    dither=dm.dither.Floyd        # The dithering algorithm to use.
)

print(m.render())

Output

No response

Anything else?

Example: DotArt by Garrett Albright

The latter example usage would require pillow as dependency. Thus it might be sensible to block this feature behind an "import guard" and add pillow as an extra-install-option, àla dotmatrix[images].

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions