Transparency issues in +level-colors option

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?".
Locked
User avatar
shveicar
Posts: 42
Joined: 2019-10-15T15:10:16-07:00
Authentication code: 1152

Transparency issues in +level-colors option

Post by shveicar »

Hello
I'm trying to make a color change for this transparent image.

Image

I use the command:

Code: Select all

convert test.png +level-colors #B34EE9, output.png
but in the Imagemagick Version 7.0.8.68 I get this result:

Image

and additional white background around the image.

Using the optional

Code: Select all

-background none
and

Code: Select all

-transparent white

here is not suitable, so it removes the white part inside the image.

Image

I want to add that in the older version of ImageMagick (v 6.8.9-8) white background is not created.

How do I configure the command to receive a color change with transparency support (in ImageMagick v 7) and this result:

Image


Thanks.
Windows, ImageMagick 7.0.8 version

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Transparency issues in +level-colors option

Post by snibgo »

For v7, I suggest you use "magick", not "convert".

In IM v6, operations by default do not include the alpha channel. In v7, by default the alpha channel is included.

So in v7 we often need to restrict operations to the RGB channels:

Code: Select all

magick test.png -channel RGB +level-colors #B34EE9, +channel output.png
snibgo's IM pages: im.snibgo.com

User avatar
shveicar
Posts: 42
Joined: 2019-10-15T15:10:16-07:00
Authentication code: 1152

Re: Transparency issues in +level-colors option

Post by shveicar »

snibgo
Thanks for the clarification.
Now It works.
Windows, ImageMagick 7.0.8 version

Locked