Skip to content

Commit

Permalink
Fix sample format tag to preserve floating point pixel type
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Jul 27, 2020
1 parent 17debd6 commit 5dc6fc6
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,16 @@ private IFD makeIFD(PyramidSeries s, int resolution, int plane)
ifd.put(IFD.COMPRESSION, getTIFFCompression().getCode());

ifd.put(IFD.PLANAR_CONFIGURATION, s.rgb ? 2 : 1);
ifd.put(IFD.SAMPLE_FORMAT, 1);

int sampleFormat = 1;
if (FormatTools.isFloatingPoint(s.pixelType)) {
sampleFormat = 3;
}
else if (FormatTools.isSigned(s.pixelType)) {
sampleFormat = 2;
}

ifd.put(IFD.SAMPLE_FORMAT, sampleFormat);

int[] bps = new int[s.rgb ? s.c : 1];
Arrays.fill(bps, FormatTools.getBytesPerPixel(s.pixelType) * 8);
Expand Down

0 comments on commit 5dc6fc6

Please sign in to comment.