Page 1 of 1

How to center an image in a fixed canvas?

Posted: 2008-04-28T07:26:06-07:00
by Rule
Hello,

Can somebody tell me how I can resize from an image to a smaller version, but really have the actual given size?
This illustrates my problem:
image 800*600
resize 400*400 --> image 400*300
--> I would like to place the image 50 pixels lower


Regards,
Roel

Re: How to center an image in a fixed canvas?

Posted: 2008-04-28T10:36:36-07:00
by fmw42
Please post questions of this nature next time to the Users forum not the Developers forum.


Unfortunately, I do not understand what you are trying to do.

What do you mean by "really have the actual given size"?

The syntax for resizing is:

If you have an 800x600 image and want it to be 400x300, then
convert image_800_400.png -resize 400x300 image_400_300.png
or
convert image_800_400.png -resize 50% image_400_300.png

If you want it to be 400x400, then

convert image_800_400.png -resize 400x400! image_400_400.png


I am not sure what you mean by "place it 50 pixels lower"? What is it relative to ? What background?

You can pad it with a border. See http://www.imagemagick.org/Usage/crop/#border
You can extend it. See http://www.imagemagick.org/Usage/crop/#extent
You can splice in rows. See http://www.imagemagick.org/Usage/crop/#splice

If you can clarify these two points for me, then perhaps I can help your further.

Re: How to center an image in a fixed canvas?

Posted: 2008-04-29T05:21:32-07:00
by Rule
Thx for all help!

I solved the problem with -repage 400*400+0+50...


Friendly regards,
Roel