Page 1 of 1

Need help on the resize and -composite in convert

Posted: 2013-08-05T00:46:27-07:00
by olaola
Hello,

I wrote command like this:

Code: Select all

convert firstimage.jpg -auto-orient -crop 2508x1791+321+320 stickerimage.png -resize 627 -geometry 600x400+827+1171 -composite -quality 98.0 -density 300 output.jpg
my puopose is to resize the stickerimage.png and put it on the firstimage.jpg with the geometry parameters, but the result is, the resize happened on the firstimage.jpg which lead to the output.jpg only with 600 in width, please help me, i tried to add () arount the stickerimage.png, but it gave me error, how can I change this command to work as I expect, please help.

Re: Need help on the resize and -composite in convert

Posted: 2013-08-05T00:56:38-07:00
by GreenKoopa
Welcome. Platform and version?

Re: Need help on the resize and -composite in convert

Posted: 2013-08-05T00:57:50-07:00
by olaola
GreenKoopa wrote:Welcome. Platform and version?
latest windowns binary on win7 x64.

i think i got it by myself, just remove the -resize seems working, don't know why, i am testing with more cases.

Re: Need help on the resize and -composite in convert

Posted: 2013-08-05T01:37:32-07:00
by Bonzo
For a start this looks wrong to me as you should just have an offset:

Code: Select all

-geometry 600x400+827+1171 
Should be
-geometry +827+1171
Posting the error may have given more information

Try this:

Code: Select all

convert ( firstimage.jpg -auto-orient -crop 2508x1791+321+320 ) stickerimage.png -resize 627x -geometry +827+1171 -composite -quality 98 -density 300 output.jpg

Re: Need help on the resize and -composite in convert

Posted: 2013-08-05T06:14:14-07:00
by olaola
Bonzo wrote:For a start this looks wrong to me as you should just have an offset:

Code: Select all

-geometry 600x400+827+1171 
Should be
-geometry +827+1171
Posting the error may have given more information

Try this:

Code: Select all

convert ( firstimage.jpg -auto-orient -crop 2508x1791+321+320 ) stickerimage.png -resize 627x -geometry +827+1171 -composite -quality 98 -density 300 output.jpg
you are right, just keep offset works fine, but the parenthesis should be placed on the 2nd image

Code: Select all

 convert firstimage.jpg -auto-orient -crop 2508x1791+321+320 (stickerimage.png -resize 627) -geometry +827+1171 -composite -quality 98 -density 300 output.jpg

Re: Need help on the resize and -composite in convert

Posted: 2013-08-05T10:45:59-07:00
by GreenKoopa
A space is required around every ( and ) .

Re: Need help on the resize and -composite in convert

Posted: 2013-08-05T21:21:53-07:00
by anthony
-geometry has two actions (historical reasons)
It resizes tha current last image, and saved the offset for composition.

See IM Examples, Resize, Geometry
http://www.imagemagick.org/Usage/resize/#geometry


You use geometry after reading the first image, so of course that is the image it resized (the only image in memory)

using -geometry for resizing is NOT recommended.