Page 1 of 1

JPG to PCX conversion - smallest output PCX file size?

Posted: 2010-08-18T19:34:22-07:00
by birdienumnum
Hi,

I have managed to use IM to convert :-

1. A colour 8 bit CMYK colour seperation JPEG to grayscale 8 bit 256 colour JPG using this command :-

"convert <jpg file> -density 200x200 -colorspace Gray <mono jpg file>"

2. The output grayscale 8 bit 256 colour JPG (from 1) to grayscale 1 bit 2 colour PCX using this command :-

"convert <mono jpg file> -colorspace gray -colors 2 -depth 1 <pcx file>"

This results in a black and white image with much less detail than the original image of course! However, this is what I need for my particular image application (a small byte sized rough 'fax like' image representation) in this case. The PCX file size is already somewhat smaller but still not as small as I would like. Are there any further suggestions on IM options/techniques for reducing the PCX file size down further without loosing any further image resolution? The sample input JPG and output JPG/PCX file sizes I got are below. Perhaps this is already the lower limit and I cannot improve on this?

Original JPG input file = 847653 bytes
Output JPG file from step 1 = 671603 bytes
Output PCX file from step 2 = 15157 bytes

Are there any suggestions e.g perhaps there is PCX file overhead to strip, or some initial work on the JPG files themselves that will help or perhaps there are better/additional options to use in these conversion steps or even better steps altogether that will help?

Any suggestion(s) are much appreciated,

Thank you.

Re: JPG to PCX conversion - smallest output PCX file size?

Posted: 2010-08-18T19:51:24-07:00
by fmw42
you can adjust the jpg compression quality with -quality in your first step.

also you can strip any profiles or other info such as exif by adding -strip in your first step.

(density in your first step is not going to affect file size in bytes, but it does not hurt to set it)