Page 1 of 1

How to retain density of source image in converted image?

Posted: 2010-10-20T16:51:06-07:00
by tnoy
I'm trying to convert a set of TIFF (possibly others) to JPEG and retain the recorded density.

For example, I'll have a source image that is 425ppi. I'll use a simple command like:
convert -quality 95 source.tif output.jpg

source.tif has 425x425ppi stored in the file header, output.jpg has 72x72ppi

I am going to be using the ppi value in the header for a few things and need it to be retained. The density of the images are all over the place, so adding a static '-density xxx' would not work well for me.

Is there a flag for -density to retain the source image's density value? or another command line option to do the same?

Re: How to retain density of source image in converted image

Posted: 2010-10-20T17:44:13-07:00
by fmw42
Post a link to your image. Tiff or JPG may have density stored in multiple places and different apps get it from different locations.

try using

convert source.tif -quality 95 output.jpg

see http://www.imagemagick.org/Usage/basics/#cmdline

Then do

identify -verbose output.jpg

and see if you have density as you want it in the IM data and see if there is a different section regarding the tiff data density near the bottom

Re: How to retain density of source image in converted image

Posted: 2010-10-22T14:32:51-07:00
by tnoy
I can't post a link to the images I was dealing with, as they're in copyright. So, I was going to post a link to another I know is safe.. but I wasn't having this issue with the other image. I'll see if I run across another image that I'm having the problem with that I can post a link to.

I can, however, provide some more technical details about the issue I'm having.

The input image has the resolution stored in its tiff header in the tags XResolution and YResolution (282 and 283)--this is according to tiffdump (from the libtiff tools). I am able to manually modify this using tiffset. The manual change shows up in the output of using 'identify -verbose'

$ identify -verbose input.tif
TIFF Directory at offset 0x929b54 (9608020)
Subfile Type: (0 = 0x0)
Image Width: 3778 Image Length: 2884
Resolution: 300, 300 pixels/inch
Bits/Sample: 8
Compression Scheme: LZW
Photometric Interpretation: RGB color
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Rows/Strip: 16
Planar Configuration: single image plane
Make: Phase One
Model: P 45+
Software: Capture One PRO 3.7.9 (3228) [sw: Capture One PRO 3.7.9] [fw: P 45+ camera, ROM 1.3, Firmware 2.9.8/1.3.4]
DateTime: 2010:08:20 21:03:34
ICC Profile: <present>, 560 bytes
Predictor: horizontal differencing 2 (0x2)
Image: input.tif
Format: TIFF (Tagged Image File Format)
Geometry: 3778x2884
Class: DirectClass
Type: true color
Depth: 8 bits-per-pixel component
Colors: 56430
Profile-color: 560 bytes
Resolution: 300x300 pixels/inch
Filesize: 9385kb
Interlace: None
Background Color: white
Border Color: #dfdfdf
Matte Color: grey74
Iterations: 0
Compression: LZW
timestamp: 2010:08:20 21:03:34
software: Capture One PRO 3.7.9 (3228) [sw: Capture One PRO 3.7.9] [fw: P 45+ camera, ROM 1.3, Firmware 2.9.8/1.3.4]
make: Phase One
model: P 45+
signature: ca0dff729404b7eeb46d28bc359f9ab8cabf850bcfeaeb7b3e8365661ba20344
Tainted: False
User Time: 0.6u
Elapsed Time: 0:01

$ convert input.tif output.jpg

$ identify -verbose output.jpg
Image: output.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Geometry: 3778x2884
Class: DirectClass
Type: true color
Depth: 8 bits-per-pixel component
Colors: 32141
Profile-color: 560 bytes
Resolution: 72x72 pixels/inch
Filesize: 687kb
Interlace: None
Background Color: white
Border Color: #dfdfdf
Matte Color: grey74
Iterations: 0
Compression: JPEG
signature: 7eba98cec3ca3b603c46d17627e067100641c92a326f17efcd8b1a3754a818d4
Tainted: False
User Time: 0.6u
Elapsed Time: 0:01

Re: How to retain density of source image in converted image

Posted: 2010-10-22T15:13:44-07:00
by tnoy
Ok, after making that last post, I discovered what seems to be the problem--aside from me not being very observant.

I was using the build of ImageMagick that was already installed on my system. It turns out that the version installed on this Solaris machine was v5.4.7. I downloaded and built v6.6.5-2 and I do not have this problem with the newer build.