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
help
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: help
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' \( -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'
/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'
-
- Posts: 12
- Joined: 2011-07-03T04:02:30-07:00
- Authentication code: 8675308
Re: help
Thanks for the reply, that's what I'm doing:
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
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: help
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'
/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'
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: help
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/