djpeg to convert jpeg images to .gif,.bmp etc

djpeg(Decompress jpeg) command can be used to convert the jpg or jpeg format images into .bmp ,.gif and other formats.

For example let us say we have a jpg file by the name temp.jpg. We can find the size of the file using the command du.

We can use the command djpeg on this file to convert it to a .gif file.


"-gif" : To specify the output the file to be of type .gif
"-outfilename" : To specify the output file name which is given above as temp.gif

After executing the command we can see the new temp.gif file in the same folder.

Thus we can see that the new file "temp.gif" has been created and it is bigger than the .jpg file as it is a decompressed file.

Insted of "-gif" we can pass the option "-bmp" to convert the image to .bmp format.

We can also remove the color from the image and make it a grayscale image from the .jpg image by passing the option "-grayscale"

We can also scale images,make them smaller, using the option -scale, where the value of scale can be any number between 1 and 16, which is the scaling factor.

The file created above will be scaled by a factor 2/8, where 8 is the default DCT size.

We can see above that temp2.gif is of smaller size than temp.gif as it has been scaled.

No comments:

Post a Comment

Follow by Email