Howto: Linux convert an image between different formats from command prompt

by Vivek Gite on May 2, 2007 · 4 comments

Q. How do I convert images from a shell prompt? For example convert an image in the JPEG format to PNG or vise versa?

A. You need to use the convert command which is a member of the ImageMagick suite of tools. Use it to convert between image formats as well as
=> Resize an image
=> Blur an image
=> Crop an image
=> Despeckle an image
=> Dither an image
=> Draw on an image
=> Flip an image
=> Join an image
=> Re-sample, and much more.

Task: Convert an image in the JPEG format to PNG

Type the command as follows:
$ convert input.jpg output.png

Task: Resize the image

Resize and convert an image in the JPEG format to PNG
$ convert -resize 50% input.jpg output.png

You can also create a complex effect such as:
$ convert -size 360x85 xc:transparent -font Bookman-DemiItalic -pointsize 72 -draw "text 25,60 'nixCraft'" -channel RGBA -gaussian 0x6 -fill YellowGreen -stroke RosyBrown -draw "text 20,55 'nixCraft'" nixCraft.png

Output:

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 3 comments… read them below or add one }

1 Dhaval April 18, 2008

This website is the best …website for linux users.

Thanks to Nixcraft.

Reply

2 pear December 14, 2009

Hi ,

I have converted *.bmp to *.ps, but the *.ps image appears to be small and displayed at the end of the page. How to delete the empty spaces and make it fit to the page with a full resolution.

I had a similar problem with ps2pdf but i used ps2pdf -dEPSCrop *.ps , i got good result

Similarly how to do with bmp to ps conversion? or is there any way to convert bmp to pdf directly with full size fit?

Reply

3 Dhavakumar February 1, 2010

How to convert dot format to jpeg format

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 9 + 12 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: