increasing the height of image not resizing

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

increasing the height of image not resizing

Post by manit »

I want to increase the height of image to create blank space at the bottom.What should be the command.Also is there a manual of imagemagick available to see all command line options offline.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: increasing the height of image not resizing

Post by fmw42 »

manit wrote:I want to increase the height of image to create blank space at the bottom.What should be the command.Also is there a manual of imagemagick available to see all command line options offline.
see -extent http://www.imagemagick.org/Usage/crop/#extent

You would have to make a PDF of the page at:

http://www.imagemagick.org/script/comma ... ptions.php
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: increasing the height of image not resizing

Post by anthony »

Use -extent if you know the final size of the image afetr the extra space is added.

However if you just want to add N pixels use -splice instead.
http://www.imagemagick.org/Usage/crop/#splice
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

Re: increasing the height of image not resizing

Post by manit »

Can you tell me the command I should write for windows version of IM to add 30 pixel blank white space at only the bottom of image.
EXAMPLE
i have original image of 640*272 and I want to replace it by 640*302 so that there is 30 pixel empty space at bottom where I can give the title.
Is it also possible to add text to an image at particular position.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: increasing the height of image not resizing

Post by fmw42 »

manit wrote:Can you tell me the command I should write for windows version of IM to add 30 pixel blank white space at only the bottom of image.
EXAMPLE
i have original image of 640*272 and I want to replace it by 640*302 so that there is 30 pixel empty space at bottom where I can give the title.
Is it also possible to add text to an image at particular position.

If you want the background white, then

convert yourimage -background white -gravity north -extent 640x302 yourextendedimage

see http://www.imagemagick.org/Usage/crop/#extent

But if you are going to annotate it, then you are better creating the annotation in an image of size 640x30 and then appending the result.

There are any number of ways to add text to an image or colored background of a given size depending upon how you want the text scaled or if you want to specify the pointsize and/or placement. See label:, caption:, -draw, -annotate at

http://www.imagemagick.org/Usage/text/

Once you do that, then just append the two images top and bottom

convert yourimage yourtextimage -append yourcombinedimage

see
http://www.imagemagick.org/script/comma ... php#append

and

http://www.imagemagick.org/Usage/layers/#append

For DOS/PC users see http://www.imagemagick.org/Usage/api/#windows
Last edited by fmw42 on 2009-02-03T17:55:23-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: increasing the height of image not resizing

Post by anthony »

Note that as the above usage example references is for UNIX you need to follow a few rules for use on DOS.

They are rather simple, and explained in Windows DOS Scripting
http://www.imagemagick.org/Usage/api/#windows
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

Re: increasing the height of image not resizing

Post by manit »

I gave the following command to add space in image of size 632*254
convert.exe "e:\joker.jpg": -background skyblue -extent 632*300 "e:\joker2.jpg"
convert.exe: unable to open image `e:\joker.jpg:': Invalid argument @ blob.c/OpenBlob/2411.
convert.exe: invalid argument for option `-extent': 632*300 @ convert.c/ConvertImageCommand/1281.

Though the file "joker.jpg" is present in e drive.What is the error in my command.I am using windows version of image magick.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: increasing the height of image not resizing

Post by anthony »

manit wrote:I gave the following command to add space in image of size 632*254
convert.exe "e:\joker.jpg": -background skyblue -extent 632*300 "e:\joker2.jpg"
convert.exe: unable to open image `e:\joker.jpg:': Invalid argument @ blob.c/OpenBlob/2411.
convert.exe: invalid argument for option `-extent': 632*300 @ convert.c/ConvertImageCommand/1281.

Though the file "joker.jpg" is present in e drive.What is the error in my command.I am using windows version of image magick.

You have an extra ':' in the first read, just outside the quotes
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

Re: increasing the height of image not resizing

Post by manit »

Thanks to all those who replied.I will soon post the things I have learnt in this thread.
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

what I have learnt from this forum

Post by manit »

to write <text> to bottom of image
convert e:\1.jpg -gravity south -annotate 0 "<text>" e:\1.jpg

to add margin at base to 316*328 image of 22 pixel
convert e:\1.jpg -background skyblue -extent 316x350 e:\1.jpg

to add 28 pixel margin at bottom of image
convert e:\2.jpg -gravity south -background skyblue -splice 0x28 e:\2.jpg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: increasing the height of image not resizing

Post by anthony »

or just append a text label regardless of image size.

convert e:\1.jpg -background skyblue label:"<text>" -gravity center -append e:\1.jpg
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply