NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 52 - ImageJA doesn't build under openjdk
ImageJA doesn't build under openjdk
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: ImageJ1
unspecified
PC Linux
: P2 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2009-05-01 09:26 CDT by Mark Longair
Modified: 2009-07-09 18:40 CDT
1 user (show)

See Also:


Attachments
A patch so that 8 bit grayscale images are written as grayscale JPEGs (767 bytes, patch)
2009-05-17 19:13 CDT, Mark Longair

Description Mark Longair 2009-05-01 09:26:42 CDT
At the moment, ImageJ (e.g. the "current" branch) builds under openjdk but
ImageJA (e.g. the "fiji" branch) fails to build with the errors below in
JPEGWriter.  There was a fix introduced in ImageJ 1.41n 52eb5b6f0f9886ed5
- was there a reason for not merging that in?

  ./ImageJA/ij/plugin/filter/AVI_Writer.java:54: warning: com.sun.image.codec.jpeg.JPEGImageEncoder is Sun proprietary API and may be removed in a future release
      private JPEGImageEncoder jpegEncoder;
            ^
  ./ImageJA/ij/io/ImageReader.java:431: warning: com.sun.image.codec.jpeg.JPEGCodec is Sun proprietary API and may be removed in a future release
  		BufferedImage bi = JPEGCodec.createJPEGDecoder(in).decodeAsBufferedImage();
  		                   ^
  ./ImageJA/ij/plugin/AVI_Reader.java:732: warning: com.sun.image.codec.jpeg.JPEGCodec is Sun proprietary API and may be removed in a future release
              bi = JPEGCodec.createJPEGDecoder(inputStream).decodeAsBufferedImage();
                   ^
  ./ImageJA/ij/plugin/JpegWriter.java:46: warning: com.sun.image.codec.jpeg.JPEGImageEncoder is Sun proprietary API and may be removed in a future release
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(f);
              ^
  ./ImageJA/ij/plugin/JpegWriter.java:46: warning: com.sun.image.codec.jpeg.JPEGCodec is Sun proprietary API and may be removed in a future release
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(f);
                                         ^
  ./ImageJA/ij/plugin/JpegWriter.java:47: warning: com.sun.image.codec.jpeg.JPEGEncodeParam is Sun proprietary API and may be removed in a future release
              JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
              ^
  ./ImageJA/ij/plugin/JpegWriter.java:50: cannot find symbol
symbol  : method setHorizontalSubsampling(int,int)
location: class com.sun.image.codec.jpeg.JPEGEncodeParam
  				param.setHorizontalSubsampling(1, 1);
  				     ^
  ./ImageJA/ij/plugin/JpegWriter.java:51: cannot find symbol
symbol  : method setHorizontalSubsampling(int,int)
location: class com.sun.image.codec.jpeg.JPEGEncodeParam
  				param.setHorizontalSubsampling(2, 1);
  				     ^
  ./ImageJA/ij/plugin/JpegWriter.java:52: cannot find symbol
symbol  : method setVerticalSubsampling(int,int)
location: class com.sun.image.codec.jpeg.JPEGEncodeParam
  				param.setVerticalSubsampling(1, 1);
  				     ^
  ./ImageJA/ij/plugin/JpegWriter.java:53: cannot find symbol
symbol  : method setVerticalSubsampling(int,int)
location: class com.sun.image.codec.jpeg.JPEGEncodeParam
				param.setVerticalSubsampling(2, 1);
  				     ^
  ./ImageJA/ij/plugin/JpegWriter.java:61: warning: com.sun.image.codec.jpeg.JPEGEncodeParam is Sun proprietary API and may be removed in a future release
					param.setDensityUnit(JPEGEncodeParam.DENSITY_UNIT_DOTS_INCH);
					                     ^
  ./ImageJA/ij/plugin/JpegWriter.java:61: cannot find symbol
symbol  : variable DENSITY_UNIT_DOTS_INCH
location: class com.sun.image.codec.jpeg.JPEGEncodeParam
  					param.setDensityUnit(JPEGEncodeParam.DENSITY_UNIT_DOTS_INCH);
  					                                    ^
  ./ImageJA/ij/plugin/filter/AVI_Writer.java:372: warning: com.sun.image.codec.jpeg.JPEGCodec is Sun proprietary API and may be removed in a future release
            jpegEncoder = JPEGCodec.createJPEGEncoder(raOutputStream);
                          ^
Comment 1 Johannes Schindelin 2009-05-14 10:51:59 CDT
Could you please test the 'imageio' branch of ImageJA?

In particular, that the subsampling is correct when quality is 100, and that the resolution is set correctly when the unit of the resolution is "inch" or "in"?

Thank you so much.
Comment 2 Mark Longair 2009-05-17 19:13:28 CDT
Created attachment 2
A patch so that 8 bit grayscale images are written as grayscale JPEGs
Comment 3 Mark Longair 2009-05-17 19:13:43 CDT
The version in that branch seems to save JPEGs OK and builds fine with
OpenJDK.  It might be worth adding the attached patch so that only one
channels is saved for GRAY8 images.  I'm not sure what you mean about the
subsampling?  The output looks fine, though.

I've tried setting units in the calibration to "in" or "inches" and changing
the voxel size, but those don't seem to be saved in the EXIF resolution fields -
it just ends up with the following in each case (output from exiftool):

Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1

Many thanks,
Mark
Comment 4 Johannes Schindelin 2009-05-18 10:32:27 CDT
Update: setting the density (resolution) does not work properly.  It will fall back to writing a .jpg ignoring all ImageJ settings such as quality or resolution.  The reason is that the methods using IIOMetadata do not work as I expected, as writer.getDefaultStreamMetadata(param) returns an instance of the _streamed_ .jpg metadata, which does not allow to set the resolution.

Will investigate further.
Comment 5 Johannes Schindelin 2009-05-25 11:10:43 CDT
Okay, I have to give up for the moment, as I have no clue how to fix the resolution thing.  As far as I can tell, the code in the 'imageio' branch should work, but it just ignores the resolution.  Any help welcome.
Comment 6 Mark Longair 2009-05-25 19:42:39 CDT
I've pushed a small change to the imageio branch that seems to fix
the writing of resolution information for me.

Unfortunately we're not quite there yet, since ImageJ doesn't seem
to get the resolution right when loading the file back in, but
jpeginfo -i, exiftool and gimp get the resolution right, so that's
some progress at least.  I'll work on that next.
Comment 7 Mark Longair 2009-05-26 10:55:40 CDT
I haven't had time to add code to read the resolution information
from JPEGs yet, but it looks as if this is the right way to do
it with ImageIO:

  http://johnbokma.com/java/obtaining-image-metadata.html
Comment 8 Johannes Schindelin 2009-06-16 11:36:53 CDT
Seems Wayne decided to scrap the dpi stuff that held us up for so long.  One one hand, good to see this included in ImageJ, on the other hand, a pity to see yet another piece of backwards-compatibility float down the river.
Comment 9 Johannes Schindelin 2009-07-09 18:40:27 CDT
Since the merge with 1.43b, we have a fix for this issue in Fiji's version of ImageJA.