Skip to content
Discussion options

You must be logged in to vote

Thanks for the prompt to get the :background_color option added to Image.flatten/2. Assuming your image is already a PNG with an alpha band, the best way is:

{:ok, flattened_image} = Image.flatten(image, background_color: :green)

This will return a 3-band image with the alpha band applied and the transparent areas set to :green. You'll need to upgrade to Image 0.52.0 which I release just a few minutes ago. It has the following changelog entry:

Enhancements

  • Adds :background_color option to Image.flatten/2.

  • Add Image.Nx to host some Nx convenience functions.

Bug Fixes

  • Fix Image.delta_e/2 to return a float (not an integer)

  • Fix Image.k_means/2 to work with images in color spaces oth…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@AntoineAugusti
Comment options

Answer selected by AntoineAugusti
Comment options

You must be logged in to vote
3 replies
@AntoineAugusti
Comment options

@kipcole9
Comment options

@AntoineAugusti
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants