Page 1 of 1

Convert many different images to one distorting

Posted: 2018-07-25T06:44:21-07:00
by kamil
Hello and greetings.
I need help or guidance.
I have a background with a pencil case, but unfortunately he is under a strange angle. I have to put a photo with a pattern (graphics) on the lower part of the pencil case. But these pictures are of various sizes and sizes. So, no image values can be rigidly set.
Image
I would like each of my graphic designs to be matched to the size of this green background.
Image

What i doing is.
1)
Open image with desing.
Resize image to size of green surface.
convert W-.png -resize 900x350 -virtual-pixel transparent -extent 900x350
2)
distort above image to corners fo green box.
Image
-distort Perspective '0,0,xRED,yRED 0,900,xWHITE,yWHITE 350,0,xBLUE,yBLUE 350,900,xYellow,yYellow'
and extent that image to size of pencilcase image -extent 1181x827
3)
Compose pencilcase and distorted image
convert '#{outFile}' MugLogo.png -geometry +1121+1292 -composite '#{outFile}'"

What you think about this. im doing it good or i miss somethink?
this is my command without part nb3:
command =" convert W-.png -resize 900x350 -virtual-pixel transparent \
-distort Perspective '0,0,200,422 0,900,208,764 900,0,1022,282 350,900,1050,605' \
-extent 1181x827 checks_pers_rev.png "

Re: Convert many different images to one distorting

Posted: 2018-07-25T09:01:32-07:00
by snibgo
You are doing a resize, then a "-distort perspective". There will be less mangling of pixels if you just do a "-distort perspective".

You need only a single "convert", instead of three.