Convert many different images to one distorting

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
kamil
Posts: 9
Joined: 2018-04-26T01:26:37-07:00
Authentication code: 1152

Convert many different images to one distorting

Post 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 "
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert many different images to one distorting

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply