Possible bug? Virtual-pixel + distort = ... gray corner ?

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
redna379
Posts: 25
Joined: 2007-02-22T21:11:40-07:00

Possible bug? Virtual-pixel + distort = ... gray corner ?

Post by redna379 »

Hello.

ImageMagick Version i'm using: 6.3.7 12/07/07 Q16

I have this source image:
Image

I apply this command:

Code: Select all

convert before.png -channel RGBA -virtual-pixel transparent -distort Perspective '0,0,0,0 400,0,400,9 0,232,116,130 400,232,376,232' distorted.png
I obtain this image:
Image

I'm going crazy. Why do i obtain that gray triangle on bottom-left corner?
It seems virtual-pixel method is not used "till there".
I tryed with background options, flatten, matte.. everything.
Any idea on what is causing that color to be placed there?

Thank you in advance,

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

Re: Possible bug? Virtual-pixel + distort = ... gray corner ?

Post by fmw42 »

You should add -matte before -channel RGBA (to be sure the alpha is create if it is not already, although in your case your image is already mostly transparent) and more importantly there is a parameter -mattecolor for areas outside the perspective. So the following works for me in IM 6.4.0-7

convert before.png -matte -channel RGBA -virtual-pixel transparent -mattecolor none \
-distort Perspective '0,0,0,0 400,0,400,9 0,232,116,130 400,232,376,232' distorted.png

See the examples at
http://www.imagemagick.org/Usage/distorts/#horizon
where -mattecolor is used to make the "skycolor"

P.S. You might want to checkout my script 3Drotate and/or rotate3D at
http://www.fmwconcepts.com/imagemagick/index.html
redna379
Posts: 25
Joined: 2007-02-22T21:11:40-07:00

Re: Possible bug? Virtual-pixel + distort = ... gray corner ?

Post by redna379 »

Yeah, mattecolor was the key!

Magick is really powerful, but there are so many options and sometimes it's really hard to find if what's needed is there or not.
Just now, evenif i read and read, i found the notes about mattecolor in Anthony's distort page.

Thank you very much Fmw42!
Post Reply