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

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:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 1 trackback }

cambiando el formato de un documento de forma facil y rapida « hombrecero
05.24.07 at 6:45 pm

{ 1 comment… read it below or add one }

1 Dhaval 04.18.08 at 12:12 pm

This website is the best …website for linux users.

Thanks to Nixcraft.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: Ubuntu Linux format USB pen drive

Next post: Howto Display text files in a shell script