Page 1 of 1

help

Posted: 2011-07-06T12:27:12-07:00
by dev.alex89
command runs slowly: ~ 8 seconds

/usr/bin/convert 'FIRST_IMG' \( -resize 270x265! -crop 270x265 -level -10% -matte -virtual-pixel transparent -distort Perspective '0,0,1,1 0,265,0,264 265,0,260,72 265,260,268,236' 'ANOTHER_IMG' \) -background none -geometry +177+186 -compose Atop -composite 'RESULT_IMG'

FIRST_IMG - jpeg (The JPEG image format) 600px × 480px
ANOTHER_IMG - PNG Image - 800px × 600px

Why so slow, what to do to make it faster?

Server ubuntu-x86_64 500 Mhz RAM 256 Mb
PHP Version 5.3.3-1ubuntu9.5
ImageMagick 6.6.2-6 2010-12-02 Q16

Re: help

Posted: 2011-07-06T13:28:20-07:00
by fmw42
/usr/bin/convert 'FIRST_IMG' \( -resize 270x265! -crop 270x265 -level -10% -matte -virtual-pixel transparent -distort Perspective '0,0,1,1 0,265,0,264 265,0,260,72 265,260,268,236' 'ANOTHER_IMG' \) -background none -geometry +177+186 -compose Atop -composite 'RESULT_IMG'
Not sure exactly what you are doing, but your syntax is off. you need to add a clone inside your parenthesis

/usr/bin/convert 'FIRST_IMG' \( +clone -resize 270x265! -crop 270x265 -level -10% -matte -virtual-pixel transparent -distort Perspective '0,0,1,1 0,265,0,264 265,0,260,72 265,260,268,236' 'ANOTHER_IMG' \) -background none -geometry +177+186 -compose Atop -composite 'RESULT_IMG'


What is 'ANOTHER_IMG'? Is that an output or another input? If another input, then replace +clone with 'ANOTHER_IMG' at the beginning of the parenthesis (input images are specified first).


/usr/bin/convert 'FIRST_IMG' \( 'ANOTHER_IMG' -resize 270x265! -crop 270x265 -level -10% -matte -virtual-pixel transparent -distort Perspective '0,0,1,1 0,265,0,264 265,0,260,72 265,260,268,236' \) -background none -geometry +177+186 -compose Atop -composite 'RESULT_IMG'

Re: help

Posted: 2011-07-07T00:13:58-07:00
by dev.alex89
Thanks for the reply, that's what I'm doing:
Image
I need to insert one image into another, and to first apply several effects, before do resizing and cropping.

FIRST_IMG is LOUIS VUITTON
ANOTHER_IMG is dolphins.jpg (img inside FIRST_IMG)

Maybe I'm wrong wrote the command, how to write correctly?
I'll try those options that you have written

Re: help

Posted: 2011-07-07T10:17:47-07:00
by fmw42
try this one -- I believe this is correct for what you describe.

/usr/bin/convert 'FIRST_IMG' \( 'ANOTHER_IMG' -resize 270x265! -crop 270x265 -level -10% -matte -virtual-pixel transparent -distort Perspective '0,0,1,1 0,265,0,264 265,0,260,72 265,260,268,236' \) -background none -geometry +177+186 -compose Atop -composite 'RESULT_IMG'

Re: help

Posted: 2011-07-09T22:15:52-07:00
by anthony
If you use +distort with the exact coordinates you want, you can then simply use -flatten or other layer operator to overlay the distorted image onto the background image.

However I would first remove any barrel or other lens distortion from the image, as that will ensure any straight lines in the image is actually straight.