how to keep png transparency while resizing

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: how to keep png transparency while resizing

Post by anthony »

Just about any form of resize is going to 'dim' thin lines.

It is a problem due to thin lines being swamped by the surrounding colors. Or as the image gets smaller, the line gets thinner, and 'disappears'.

There has been little in the way of reported solutions, except to use some techniques to thicken a line.

For example see a rough note I made in
http://www.imagemagick.org/Usage/compose/#darken
assuming your lines are black you can 'jitter' the image around a little and compose the jittered images together with a 'darken' composition method. That will select the darker value of each color channel.

NOTE: Darken may have some problem if the darkening is done on a 'per channel' basis, (as per Photoshop), but I have not verified if that is the case for IM. If this is a problem, some yet to be developed methods of properly darkening, such as only darkening the 'luminence' channel of an image in HSL colorspace.

If this is not what you are talking about some examples of your problem may be in order.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply