How to convert images between formats

Use convert to convert the file format of an image. Give the name of the file to convert as the first argument, and the destination file as the second argument. When you convert a file, the original is not altered.

To specify the file type to convert to, use that file type's standard file extension in the file name of the converted file. To convert the JPEG file `phoenix.jpeg' to a PNG image, type:

$ convert phoenix.jpeg phoenix.png RET

This command converts the JPEG image `phoenix.jpeg' to PNG format and writes it to a new file,`phoenix.png'. The following table lists the file extensions to use and describes their format. (The convention is to give extensions in all lowercase letters.)

When converting a file to JPEG format, be sure to use the `−interlace NONE' option to make sure the resultant JPEG image is non−interlaced−−unless, of course, you want an interlaced image; an interlaced image is drawn in multiple passes, and is often used on the Web where a reader may view the low−resolution image consisting of early passes before the entire image is downloaded. A non−interlaced image is drawn in one single pass. For example, use convert to convert a PNM file to non−interlaced JPEG, while sharpening it, adding a border, and adding a copyright statement.

NOTE: Some image formats are "lossy," in that some image information is lost when you convert to it. For example, the JPEG format is a lossy format that is usually used for photographic images. If you convert a file from its source PNM format to JPEG and then back to PNM, the resultant PNM will not be identical to the original source PNM.

Posted on: 17/12/2009

If you want to leave a comment please Login or Register