Page 1 of 1

extent and image position

Posted: 2013-09-14T09:39:28-07:00
by Marquisk2
I'm using the command line tool and I'm trying to use extent to extend the canvas of an image in all directions. Meaning, Top, Left, Right, and Bottom.

Here is my command line text:

convert -verbose -background none -extent 480x500 -limit memory 68 -limit map 68 /location/to/file/bookmark1_6.svg /location/to/file/temp/1379205695_5.png

I've tried this to change the offset of the image as a test: convert -verbose -background none -extent 480x500+250+300 -limit memory 68 -limit map 68 /location/to/file/bookmark1_6.svg /location/to/file/temp/1379205695_5.png


I've also tried adding geometry separate like this:
convert -verbose -background none -geometry +250+300 -extent 480x500 -limit memory 68 -limit map 68 /location/to/file/bookmark1_6.svg /location/to/file/temp/1379205695_5.png

but all these do is extend the bottom of the image. I can't seem to offset the position of the original image, or use extent to add more to the canvas in different directions.

Any suggestions?

Re: extent and image position

Posted: 2013-09-14T09:46:47-07:00
by snibgo
By default, your image is placed on the "North" side of the extent. You probably want the centre:

Code: Select all

convert in.svg -gravity Center -extent 480x500 out.png
Note: the proper place for gravity and extent is after the input image, not before.

Re: extent and image position

Posted: 2013-09-14T09:57:07-07:00
by Marquisk2
Thanks for the quick response!

Unfortunately I tried moving the extent and gravity to after the input file like this:

convert -verbose -background none -limit memory 68 -limit map 68 /location/to/file/bookmark1_6.svg -extent 480x500 -gravity Center /location/to/file/temp/1379205695_5.png

and the image is still up top. I even tried it again with geometry with no luck. :(

Re: extent and image position

Posted: 2013-09-14T10:40:10-07:00
by snibgo
"-gravity" has an effect on "-extent", but only if it comes before it in the command. When placed after it, it has no effect.

As a general rule, options should be placed in their "logical" order: read an image, set an option that modifies the action of "extent", do the extent, write the image.