thorfdbg / libjpeg

A complete implementation of 10918-1 (JPEG) coming from jpeg.org (the ISO group) with extensions for HDR, lossless and alpha channel coding standardized as ISO/IEC 18477 (JPEG XT).
327 stars 81 forks source link

Allow creation of default Baseline JPEG image: JPGFLAG_BASELINE #59

Closed malaterre closed 3 years ago

malaterre commented 3 years ago

jpeg command line tool does not allow creation of default baseline JPEG, it always default to sequential extended:

int frametype = JPGFLAG_SEQUENTIAL;

There is no way then to reset back frametype to JPGFLAG_BASELINE.

Typical setup (create an 8x8 RGB black image):

$ convert -depth 8 -size 8x8 xc:black black.ppm
$ jpeg -h -s 1x1,2x2,2x2 -q 100 black.ppm black_jpeg.jpg

compare to the ijg/turbo-jpeg:

$ cjpeg -optimize -quality 100 -outfile black_cjpeg.jpg black.ppm

libjpeg it creating:

while ijg/turbo-jpeg creates:

(as a side note it would also be nice to be able to remove the APPBmarker completely).

thorfdbg commented 3 years ago

Added a "-bl" option to enforce encoding in the baseline mode. Please test and re-open if this does not work as expected.