Hello.
Sorry about my grammar, English isn't my tang.
Thank you to for you help me in the past.
My question is how I make a box image (Ex: 100X100px) from any size or dimensions of image.
I mean If the source image is 130x40 I want ImageMagick to resize&crop it so the dest that I get will be 100X100
I don't want to change the aspect ratio of the image, I want to resize&crop to the center.
I am using convert.exe command line, or ImageMagickObject COM+.
Thank you.
Making box image for any image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Making box image for any image
try
convert inputimage -resize 100x100^ -gravity center -crop 100x100+0+0 +repage outputimage
see -resize and image geometries about the use ^ for making the smaller dimension resize to 100.
http://www.imagemagick.org/script/comma ... p#geometry
also see http://www.imagemagick.org/Usage/api/#windows regarding special escape characters for windows.
so for windows this likely needs to be either
convert inputimage -resize 100x100^^ -gravity center -crop 100x100+0+0 +repage outputimage
or
convert inputimage -resize "100x100^" -gravity center -crop 100x100+0+0 +repage outputimage
convert inputimage -resize 100x100^ -gravity center -crop 100x100+0+0 +repage outputimage
see -resize and image geometries about the use ^ for making the smaller dimension resize to 100.
http://www.imagemagick.org/script/comma ... p#geometry
also see http://www.imagemagick.org/Usage/api/#windows regarding special escape characters for windows.
so for windows this likely needs to be either
convert inputimage -resize 100x100^^ -gravity center -crop 100x100+0+0 +repage outputimage
or
convert inputimage -resize "100x100^" -gravity center -crop 100x100+0+0 +repage outputimage
Re: Making box image for any image
Great!
Thank you.
This is the command, that solve my problem:
It's working.
Thank you.
Thank you.
This is the command, that solve my problem:
Code: Select all
convert candelete.jpg -resize "100X100^" -gravity center -crop 100X100+0+0 win:
Thank you.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Making box image for any image
You should keep the +repage at the end to avoid the virtual canvas size being different from the image, so that further processing does not have errors.DannyGM wrote:Great!
Thank you.
This is the command, that solve my problem:
It's working.Code: Select all
convert candelete.jpg -resize "100X100^" -gravity center -crop 100X100+0+0 win:
Thank you.
see
http://www.imagemagick.org/script/comma ... php#repage