Dear all,
I tried to save a binary mask as a 1-bit-per-pixel file using "File>Save As>Compressed TIFF ...". After confirming that I want to save it using 1 bit per pixel, I get the following error message: java.lang.IllegalArgumentException: Input ByteProcessor has to have index color model with map size of 2, got 256. at net.sf.ij.jaiio.BufferedImageCreator.createBinary(BufferedImageCreator.java:102) at net.sf.ij.jaiio.BufferedImageCreator.create(BufferedImageCreator.java:77) at net.sf.ij.jaiio.JAIWriter.write(JAIWriter.java:143) at net.sf.ij.plugin.ImageIOSaveAsPlugin.write(ImageIOSaveAsPlugin.java:237) at net.sf.ij.plugin.ImageIOSaveAsPlugin.run(ImageIOSaveAsPlugin.java:207) [...] I already tried editing the LUT to contain only 2 colours, and choosing different compression methods... I guess the problem is that the image still has 256 grey levels (of which only 0 and 255 are used). How can I reduce the map size to 2? Is there any other memory-saving way of saving big binary images? Thanks, Jan |
Hi,
On Sun, 6 Sep 2009, Jan Eglinger wrote: > I already tried editing the LUT to contain only 2 colours, and choosing > different compression methods... I guess the problem is that the image > still has 256 grey levels (of which only 0 and 255 are used). > > How can I reduce the map size to 2? I think you have to use "Image>Type>RGB" followed by "Image>Type>8-bit Color" (where you choose 2 channels only). Hth, Dscho |
Hi,
Johannes Schindelin wrote: >> How can I reduce the map size to 2? > > I think you have to use "Image>Type>RGB" followed by "Image>Type>8-bit > Color" (where you choose 2 channels only). thx, I didn't think of that option via "8-bit Color" yet. However, that doesn't eliminate but only changes the error message when I try to save as 1-bit-per-pixel tiff. Now it reads: java.lang.IllegalStateException: Internal error: wrong size of destPixels. at net.sf.ij.jaiio.BufferedImageCreator.createBinary(BufferedImageCreator.java:116) Any ideas? Jan |
In reply to this post by Jan Eglinger-5
Just curious:
Where did you find the command: "File>Save As>Compressed TIFF ..." (I'm using "ImageJ 1.43g daily built" and can't find it.) >Dear all, > >I tried to save a binary mask as a 1-bit-per-pixel file using "File>Save >As>Compressed TIFF ...". >After confirming that I want to save it using 1 bit per pixel, I get the >following error message: > > >java.lang.IllegalArgumentException: Input ByteProcessor has to have >index color model with map size of 2, got 256. > at >net.sf.ij.jaiio.BufferedImageCreator.createBinary(BufferedImageCreator.java:102) > at >net.sf.ij.jaiio.BufferedImageCreator.create(BufferedImageCreator.java:77) > at net.sf.ij.jaiio.JAIWriter.write(JAIWriter.java:143) > at >net.sf.ij.plugin.ImageIOSaveAsPlugin.write(ImageIOSaveAsPlugin.java:237) > at net.sf.ij.plugin.ImageIOSaveAsPlugin.run(ImageIOSaveAsPlugin.java:207) >[...] > > >I already tried editing the LUT to contain only 2 colours, and choosing >different compression methods... I guess the problem is that the image >still has 256 grey levels (of which only 0 and 255 are used). > >How can I reduce the map size to 2? > >Is there any other memory-saving way of saving big binary images? > >Thanks, >Jan AFAIK ImageJ uses minimum 8bit per pixel. Best -- Herbie ------------------------ <http://www.gluender.de> |
Hi,
Gluender wrote: > Just curious: > > Where did you find the command: "File>Save As>Compressed TIFF ..." I just noticed that the function is residing in the ImageIO plugin by Jerek Sacha: http://ij-plugins.sourceforge.net/plugins/imageio/ Just filed the bug on the sourceforge page as well.. >> Is there any other memory-saving way of saving big binary images? > > AFAIK ImageJ uses minimum 8bit per pixel. I was just wondering if there is a better way to save huge binary masks than to waste 7/8 of the disk space. During processing, it doesn't make any difference, since IJ is using 8bit per pixel minimum, that's right. Best, Jan |
Hi Jan,
if ImagIO really does **compressed** TIIFs, I would assume that the compression algo is smart enough to not waste 7/8 of disk space, i.e. that the final size of the compressed TIFF is almost the same, be it a true binary image or a "8-bit image" that only has 0 and 255 as pixel content. Did you check that? (Using another program that can do both kinds of compressed images) Image compressing works on adapting the final code to the occurence frequency of certain symbols and would detect that there is only 0 and 255, I assume!) Mit freundlichen Grüßen / Best regards Joachim Wesner Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht Wetzlar HRB 2432 Geschäftsführer: Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy Martyr | Colin Davis www.leica-microsystems.com Jan Eglinger <eglinger@MPI-CBG .DE> An Gesendet von: [hidden email] ImageJ Interest Kopie Group <[hidden email]. Thema GOV> Re: saving binary as 1 bit-per-pixel tif 07.09.2009 12:03 Bitte antworten an ImageJ Interest Group <[hidden email]. GOV> Hi, Gluender wrote: > Just curious: > > Where did you find the command: "File>Save As>Compressed TIFF ..." I just noticed that the function is residing in the ImageIO plugin by Jerek Sacha: http://ij-plugins.sourceforge.net/plugins/imageio/ Just filed the bug on the sourceforge page as well.. >> Is there any other memory-saving way of saving big binary images? > > AFAIK ImageJ uses minimum 8bit per pixel. I was just wondering if there is a better way to save huge binary masks than to waste 7/8 of the disk space. During processing, it doesn't make any difference, since IJ is using 8bit per pixel minimum, that's right. Best, Jan ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
In reply to this post by Jan Eglinger-5
On Sep 7, 2009, at 6:03 AM, Jan Eglinger wrote:
> Hi, > > Gluender wrote: >> Just curious: >> >> Where did you find the command: "File>Save As>Compressed TIFF ..." > I just noticed that the function is residing in the ImageIO plugin by > Jerek Sacha: > > http://ij-plugins.sourceforge.net/plugins/imageio/ > > Just filed the bug on the sourceforge page as well.. > > >>> Is there any other memory-saving way of saving big binary images? >> >> AFAIK ImageJ uses minimum 8bit per pixel. > I was just wondering if there is a better way to save huge binary > masks > than to waste 7/8 of the disk space. > During processing, it doesn't make any difference, since IJ is using > 8bit per pixel minimum, that's right. Use File>Save As ZIP. As a test, I saved a 4000x4000 binary mask in ZIP format and it was 300 times smaller (52K) compared to saving in uncompressed TIFF format (15.3MB). You can open ZIP files created by File>Save As>ZIP using File>Open or by drag and drop. -wayne |
Free forum by Nabble | Edit this page |