Hi,
I'm trying to use the command line tools to do some image work. I'm trying to take an image, distort it (specifically skew and resize), then compose on a larger transparent background at a set pair of points.
My command so far is as follows:
convert -size 1600x1000 xc:none image1.png -matte -virtual-pixel transparent -distort Affine '0,0,230,336,1600,0,1160,310,1600,1000,1058,634,0,1000,100,536' -compose Over -geometry +0+0 -composite +repage output.png
What's happening is the image gets skewed and resized and composed but is placed in the middle of the image. If I use +distort the compose seems to be completely ignored.
It should be noted that the coords I use for the distort are the corners of the image in question. It should also be noted that the destination coords I use are specific coords picked out of photoshop, (I'm basically applying an image to a "shell" recipient image, therefore the destination coords are those that make the image I'm working on fit within the recipient, hope that makes sense). What I'm concerned about is what I've seen so far is that these coords are not matching up, so I'm assuming I'm missing something from the above query.
Thoughts?
Image distort and compose
Re: Image distort and compose
When I think about it I could use Imagick to just compose the images separately, but it would be nice to have it in one command The rest of my script uses Imagick but I was unable to get the distortion that I needed with it so tried the command line. The distortion mentioned being that a solid image is skewed such that the rectangle that incloses it is transparent, therefore you can now "see behind" the image as it has been skewed. I was able to get it to work with a png that already had a transparent background but not so much with a solid image, so if anyone had any thoughts about that and sticking with Imagick that would be great as well.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Image distort and compose
try setting the -gravity before you -geometry. but note the last image in the composite may be resized if the -geometry does not include WxH.
see comment at http://www.imagemagick.org/Usage/layers/#convert
you could try -geometry 100x100%+x+y and see if that works, but I have not tested it.
see comment at http://www.imagemagick.org/Usage/layers/#convert
you could try -geometry 100x100%+x+y and see if that works, but I have not tested it.