Login  Register

Antwort: Change in image resolution of JPEG

Posted by Joachim Wesner on Apr 05, 2008; 8:14pm
URL: http://imagej.273.s1.nabble.com/Change-in-image-resolution-of-JPEG-tp3696665p3696670.html

Hi Manuel

ImageJ Interest Group <[hidden email]> schrieb am 05.04.2008 19:49:50:

> Hello
>
> I am using ImageJ to add a scale bar to JPEG files taken with a digital
> camera. These are 2048x1536 pix images that are rendered as 17.34 x 13
cm,
> 300 pix/in images (these data from Photoshop). When I apply a scale bar
to
> them in ImageJ and save them in Jpeg (at 100 quality) they become
> 2048x1536 pix images that are rendedreed at 72.25x54.19 cm, i.e. 72 pix
> per inch (data also from Photoshop). This is problematic because they are

> to go inserted as linked files in a Word document and when I update the
> Word field to point to the new images with the scale bars they blow up.
> Could anyone let me know if there is an easy fix for this? Is there a
> global parameter that makes Imagej save the Jpegs at 300 pix/inch? Thanks

> in advance
>
> Manuel

Are you sure that in the IJ output file there is any resolution unit set at
all?
Or is it Photoshop that defaults to 72pix/inch when there is no special
info in
the file? (I would not call this a change in resolution, as the images are
still
2048x1536, but a change in scale factor resp. pixel density)

The (default) IJ Jpeg writing code is in the built-in plugin
JpegWriter.java.
Apparently, it uses encoder.getDefaultJPEGEncodeParam() to get default
encoding
params before the image is saved, the only param to be changed from the
default is
the quality. One would need to call setDensityUnit() on the param object to
set a
different scale factor as eg. 300pix/inch, but currently the code seems to
rely
on the default settings (I could not find if 72 is really the default or it
uses
"unset" in this case).

Somewhere in this forum and not too long ago there was a thread about an
alternative
JPEG writer that supports higher quality settings than the one used in
JpegWriter.java.
Maybe this writer also supports setting the DensityUnit as you would need
it.

Joachim


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________