djpeg -crop: Exit gracefully with non-PPM formats

... and document that only PPM/PGM output images are supported with the
-crop option for the moment.

I investigated the possibility of supporting -crop with -bmp, but even
after resetting the buffer dimensions, I still kept getting virtual
array access errors.  It seems that doing this the "right way" would
require creating a re-initialization function for each image format's
destination manager.  I'm disinclined to do that right now, given that
this feature was Google's baby (developed as a prerequisite for
including libjpeg-turbo in Android), and the -crop option in djpeg is
intended only as an example of how to use the partial image
decompression API.  Real-world applications would need to handle this
in their own destination managers.

It would probably be possible to make this work with Targa by employing
a similar hack to the one we used with PPM, but Targa isn't popular
enough to bother.

Fixes #185
This commit is contained in:
DRC
2017-11-08 21:01:57 -06:00
parent 1b385f37f3
commit 073b0e88a1
3 changed files with 11 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
.TH DJPEG 1 "18 March 2017"
.TH DJPEG 1 "8 November 2017"
.SH NAME
djpeg \- decompress a JPEG file to an image file
.SH SYNOPSIS
@@ -204,7 +204,8 @@ Decompress only a rectangular subregion of the image, starting at point X,Y
with width W and height H. If necessary, X will be shifted left to the nearest
iMCU boundary, and the width will be increased accordingly. Note that if
decompression scaling is being used, then X, Y, W, and H are relative to the
scaled image dimensions.
scaled image dimensions. Currently this option only works with the
PBMPLUS (PPM/PGM) output format.
.TP
.B \-verbose
Enable debug printout. More