Virtual pixel transparent apparantly failing

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
mmsood99
Posts: 4
Joined: 2012-01-05T13:56:48-07:00
Authentication code: 8675308

Virtual pixel transparent apparantly failing

Post by mmsood99 »

Hi

I am using a simple command to attempt to distort an image and make the virtual pixels transparent:

convert input.png -virtual-pixel Transparent -distort Arc 20 +repage output.png

But the resulting image has black pixels where I expect the virtual pixels to be. They render black in gimp, paint etc

I posted the input and output images at the links below:

Input
http://www.flickr.com/photos/51035382@N00/6694667523/

Output:
http://www.flickr.com/photos/51035382@N00/6694667555/

Please, what am i doing wrong?
Thanks
mmsood99
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Virtual pixel transparent apparantly failing

Post by fmw42 »

Looks like you may have found a bug and I will forward it to the Bugs forum.

convert rose: -virtual-pixel transparent -distort arc 20 +repage rose_arc.png

The above gives a black background and is ignoring setting the alpha channel



But either of these work fine.

convert rose: -virtual-pixel background -background none -distort arc 20 rose_arc2.png

or

convert rose: -channel rgba -alpha on -virtual-pixel transparent -distort arc 20 +repage rose_arc3.png
mmsood99
Posts: 4
Joined: 2012-01-05T13:56:48-07:00
Authentication code: 8675308

Re: Virtual pixel transparent apparantly failing

Post by mmsood99 »

Many thanks for your prompt attention to this and your examples.

The following *seemed* to work also:
convert input.png -alpha set -virtual-pixel Transparent -distort Arc 20 +repage output.png

Thanks
mmsood99
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Virtual pixel transparent apparantly failing

Post by fmw42 »

Magick or Anthony,

Is this a bug or am I misunderstanding something here.

Why does this not work (without setting -alpha set)

convert rose: -virtual-pixel transparent -distort arc 20 +repage rose_arc.png

The above gives a black background and is ignoring setting the alpha channel



But this works fine (without setting -alpha set)

convert rose: -virtual-pixel background -background none -distort arc 20 rose_arc2.png
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Virtual pixel transparent apparantly failing

Post by anthony »

It is not a bug. the input image just did not have a alpha channel to put transparent pixel into the image!

-alpha set was the correct solution.

I think setting background to none caused new 'blank' images to be set with an alpha channel even though the source image did not have an alpha channel. Seems to be a weird effect!

I say this because this also creates transparent in the reuslt.

Code: Select all

convert rose: -virtual-pixel transparent -background none +distort SRT 45 show:
but without -background it fails!

In other words you found a weird 'side-effect' in IM image creation function.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Virtual pixel transparent apparantly failing

Post by fmw42 »

Seems to me that it would make sense to have -virtual-pixel transparent also set the alpha channel. It seems obvious when using it that that is what you want it to do.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Virtual pixel transparent apparantly failing

Post by anthony »

It does indeed. Perhaps a word to Magick is in order!

Specifically that a alpha channel is enabled for new image clones (in the special internal case that an image is cloned but without copying the image data as image is being resized or data modified from source image) and background or virtual-pixel indicates user my need it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply