Page 1 of 1

JPEG 8-bit Grayscale not supported?

PostPosted: Mon Oct 30, 2017 3:48 pm
by darwinjob
Hi
I get unexpected results when I try to read and save 512x512 piece from JPEG image:
Code: Select all
public class TestReader {
   public static void main(String[] args) throws FormatException, IOException {
      ImageReader tr = new ImageReader();
      tr.setId("E:/tmp/T1_3_1_SST11D_0159.jpg");
      BufferedImageReader bir = new BufferedImageReader(tr);
           BufferedImage bi = bir.openImage(0, 10000, 10000, 512, 512);
      File outputfile = new File("saved.png");
      ImageIO.write(bi, "png", outputfile);
      bir.close();
   }
}


Image

The input file: http://folk.uio.no/dmitrd/bio-formats/T ... D_0059.jpg

Version 5.7.1, W764

Re: JPEG 8-bit Grayscale not supported?

PostPosted: Tue Oct 31, 2017 5:18 pm
by rleigh
Thank you for providing the sample file. I can reproduce this and I get exactly the same result as in the image you posted. I've opened https://trello.com/c/BzUB5Fuw/196-jpegr ... eg-failure for further investigation. There seems to be both excessively high memory usage and a failure to return valid pixel data.

The original file seems fine. I can open this with several tools using libjpeg-turbo to read the file, which is what the Bio-Formats JPEG reader is using itself.

Regards,
Roger

Re: JPEG 8-bit Grayscale not supported?

PostPosted: Thu Apr 05, 2018 1:49 pm
by dgault
As a follow up to this issue, a fix has now been put in place and will be included in the upcoming release of Bio-Formats 5.8.2.

https://github.com/openmicroscopy/bioformats/pull/3114
https://trello.com/c/BzUB5Fuw/10-jpegre ... pixel-data

Re: JPEG 8-bit Grayscale not supported?

PostPosted: Tue Jun 19, 2018 4:47 pm
by darwinjob
OK, this one seems to be fixed, thank you. But now it looks like JPEG-compressed TIFFs are broken :evil:
See separate thread viewtopic.php?f=13&t=8527