Skip to content

Commit

Permalink
#837: Now uses last app segment for color space detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldk committed Oct 18, 2023
1 parent 57680f1 commit 2c7c47b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -888,20 +888,21 @@ Frame getSOF() throws IOException {
throw new IIOException("No SOF segment in stream");
}

private Application lastAppSegment(int marker, String identifier) throws IOException {
List<Application> appSegments = getAppSegments(marker, identifier);
return appSegments.isEmpty() ? null : appSegments.get(appSegments.size() - 1);
}

AdobeDCT getAdobeDCT() throws IOException {
List<Application> adobe = getAppSegments(JPEG.APP14, "Adobe");
return adobe.isEmpty() ? null : (AdobeDCT) adobe.get(0);
return (AdobeDCT) lastAppSegment(JPEG.APP14, "Adobe");
}

JFIF getJFIF() throws IOException{
List<Application> jfif = getAppSegments(JPEG.APP0, "JFIF");
return jfif.isEmpty() ? null : (JFIF) jfif.get(0);

return (JFIF) lastAppSegment(JPEG.APP0, "JFIF");
}

JFXX getJFXX() throws IOException {
List<Application> jfxx = getAppSegments(JPEG.APP0, "JFXX");
return jfxx.isEmpty() ? null : (JFXX) jfxx.get(0);
return (JFXX) lastAppSegment(JPEG.APP0, "JFXX");
}

private EXIF getExif() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* @version $Id: JPEGImageReaderSpi.java,v 1.0 24.01.11 22.12 haraldk Exp$
*/
public final class JPEGImageReaderSpi extends ImageReaderSpiBase {
protected ImageReaderSpi delegateProvider;
ImageReaderSpi delegateProvider;

/**
* Constructor for use by {@link javax.imageio.spi.IIORegistry} only.
Expand Down

0 comments on commit 2c7c47b

Please sign in to comment.