Skip to content

Resize operation creates grey lines on image with transparency #4588

Discussion options

You must be logged in to vote

Hi @most-available-username,

resize doesn't know about alpha channels -- it treats all bands equally. Therefore, if there's an alpha, you need to premultiply before resize. Something like (python):

image = image.premultiply().resize(0.3).unpremultiply()

thumbnail is a higher-level resize operation and it does all of this stuff for you.

There are usually three approaches:

  1. Set a policy of "all alpha is premultiplied" (cairo does this) and premultiply / unpremultiply on load and save
  2. Pick "no alpha is premultiplied" (imagemagick does this) and premultiply / unpremultiply around operations which combine pixels (it's not just resize)
  3. Have a "image is premultiplied" flag on each image to indic…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@most-available-username
Comment options

Answer selected by most-available-username
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
Converted from issue

This discussion was converted from issue #4587 on June 27, 2025 11:06.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy