Hi team,
we have a question on if we could expand canvas area of an image in a particular direction.
Here is a screencap of what I’m referring to.
https://www.screencast.com/t/ExB1T9iNFj
(the link can be opened in internet explorer)
Let us know if there is any command with the ImageMagick scripting. Most importantly is the ability to perform percentage based expansion from a particular anchor point/direction.It would be helpful if you can give a "convert" script for expanding canvas area of an image
The IMM version which we use is ImageMagick-6.6.9-Q16 and the ghost script version is gs9.05. We have a limitation and hence we cannot upgrade the IMM version.
Thanks
lakshmi
how to expand canvas area of an image in a particular direction
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how to expand canvas area of an image in a particular direction
Code: Select all
convert rose: -gravity East -extent 120%x100% e.png
I don't know if this works in v6.6.9.
snibgo's IM pages: im.snibgo.com
Re: how to expand canvas area of an image in a particular direction
Hi ,
Thank you so much for the below code is not working
convert rose: -gravity East -extent 120%x100% e.png
unfortunately the command is not working in v6.6.9
can you please give me an command which will work in 6.6.9
thanks
Thank you so much for the below code is not working
convert rose: -gravity East -extent 120%x100% e.png
unfortunately the command is not working in v6.6.9
can you please give me an command which will work in 6.6.9
thanks
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how to expand canvas area of an image in a particular direction
This might work:
That is Windows CMD syntax. For bash, escape the parentheses: \( and \).
Code: Select all
convert rose: ( +clone -scale 120%x100% -fill White -colorize 100 ) +swap -gravity East -composite out.png
snibgo's IM pages: im.snibgo.com
Re: how to expand canvas area of an image in a particular direction
Hi ,
Thank you for the reply,
both the above mentioned codes are working . I did a mistake by not replacing Rose
however I would want to expand the image on all side
hence I tried the below command and it is working . All the sides has an equal expansion (top and bottom of equal size , and left and right are of equal size )
Is it possible to expand the top more than the bottom and the sides less than the top but more than the bottom.
in other words can we perform mutilple expansion in one command .
Please let me know if the above condition can be acheived
Thank you for the reply,
both the above mentioned codes are working . I did a mistake by not replacing Rose
however I would want to expand the image on all side
hence I tried the below command and it is working . All the sides has an equal expansion (top and bottom of equal size , and left and right are of equal size )
Code: Select all
convert "%1"[0] -gravity center -extent 120%x120% "%2".
in other words can we perform mutilple expansion in one command .
Please let me know if the above condition can be acheived
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how to expand canvas area of an image in a particular direction
You can do as many operations as you want in a single command, eg:
Code: Select all
convert rose: -gravity East -extent 120%x100% -gravity North -extent 100%x130% e.png
snibgo's IM pages: im.snibgo.com
Re: how to expand canvas area of an image in a particular direction
Thank you so much it is working
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to expand canvas area of an image in a particular direction
You can also use +-X+-Y added to the extent. The + sign moves it up and to the left. The - sign moves it down and to the right.
Compare:
with
The X and Y are always in pixels.
Compare:
Code: Select all
convert rose: -gravity center -extent 200%x200% tmp1.png
Code: Select all
convert rose: -gravity center -extent 200%x200%-10-10 tmp2.png