Page 1 of 1

How to change png file parameter IHDR width using imageshack

Posted: 2016-08-02T04:55:25-07:00
by sekhar916
I have a image with X*Y size say 42*42 and I want to change the X part to 384 fixed. I have a sofware which accpets only 384*Y size of images.I can change manually the X to 384 using paint.

Open the image in paint.
press ctrl+e a windows will open with image properties
Change the Width to 384.
It adds some white space to that image. so that my original image doesnt gets altered.
My original image

http://i.stack.imgur.com/kXhet.png

altered picture

http://i.stack.imgur.com/zrH1Y.png

if you download the image then you can find the difference. My question is how can I do it using imagemagick command line.

Re: How to change png file parameter IHDR width using imageshack

Posted: 2016-08-02T06:08:30-07:00
by roipoussiere
How to change png file parameter IHDR width using imageshack
I suppose you mean using imagemagick

You can use extent to change the image width without altering the image, and set the background to white:

Code: Select all

convert kXhet.png -background white -extent 384x42 output.png
result:

Image

Re: How to change png file parameter IHDR width using imageshack

Posted: 2016-08-02T08:57:22-07:00
by fmw42
You can add -gravity XX to put the padding on the left, right or center (using XX = west, east or center)

Re: How to change png file parameter IHDR width using imageshack

Posted: 2016-08-02T21:08:31-07:00
by sekhar916
roipoussiere wrote:
How to change png file parameter IHDR width using imageshack
I suppose you mean using imagemagick

You can use extent to change the image width without altering the image, and set the background to white:

Code: Select all

convert kXhet.png -background white -extent 384x42 output.png
result:

Image
thanks man the command worked like charm.....imagemagick community is very helpful