TIFF conversion errors

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jbogdani
Posts: 3
Joined: 2012-11-28T02:05:10-07:00
Authentication code: 6789

TIFF conversion errors

Post by jbogdani »

Hello all,
I have set a procedure in my software that creates thumbnails using command line imagemagick. This is my command:

Code: Select all

/usr/local/bin/convert image -thumbnail 200x200 thumb-image.jpg
and this works fine for almost all image files, but some of these are returning errors & warnings. Here is a one of the errors I'm getting:

Code: Select all

convert: DGT022430.TIF: wrong data type 3 for "GainControl"; tag ignored. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/767.
.
Two thumbnails are created for these images: thumb-image-01.jpg and thumb-image-2.jpg having same dimensions and resolution but different file sizes and image qualities. The only difference I can notice is in the Color profile: the better image has Nikon sRGB 4.0.0.3001 and the worst has no color profile.
I'm getting the same results on different machines (WIN and MacOS X).
I think (but I'm not sure) it's a color profile problem. Trying to remove all profiles (http://www.imagemagick.org/script/comma ... hp#profile) using

Code: Select all

+profile "*"
does not work!
What I need is to have a single way to create thumbnails for different images. I don't care about output quality.
Thank you

User avatar
fmw42
Posts: 26249
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TIFF conversion errors

Post by fmw42 »

Your tif probably has two layers. Can you post a link to an example image that fails and describe what is failing? If not, then post the results of

identify -verbose image


Is it that you get two output images and are expecting only one?

If you only expect one output for all files, then simply use the first layer/frame, [0], which is usually the flattened layers image.

convert image.tif[0] -thumbnail 200x200 thumb-image.jpg

jbogdani
Posts: 3
Joined: 2012-11-28T02:05:10-07:00
Authentication code: 6789

Re: TIFF conversion errors

Post by jbogdani »

Hello,
Opening the image with photoshop I can see only one layer.
Anyway using convert image.tif[0] -thumbnail 200x200 thumb-image.jpg I get only one image, but I still get the error:

Code: Select all

convert DGT022430.TIF[0] -thumbnail 200x200 test.jpg
convert: DGT022430.TIF: wrong data type 3 for "GainControl"; tag ignored. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/767.
Follows the result of

Code: Select all

identify -verbose DGT022430.TIF 
Image: DGT022430.TIF
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 4192x2666+0+0
Resolution: 300x300
Print size: 13.9733x8.88667
Units: PixelsPerInch
Type: TrueColor
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 0 (0)
max: 255 (1)
mean: 124.914 (0.48986)
standard deviation: 42.5071 (0.166695)
kurtosis: 0.355589
skewness: -0.870321
Green:
min: 0 (0)
max: 255 (1)
mean: 120.693 (0.473307)
standard deviation: 45.7506 (0.179414)
kurtosis: -0.315352
skewness: -0.415294
Blue:
min: 0 (0)
max: 255 (1)
mean: 114.645 (0.449589)
standard deviation: 45.8911 (0.179965)
kurtosis: -0.453102
skewness: -0.149606
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 120.084 (0.470919)
standard deviation: 44.7436 (0.175465)
kurtosis: -0.20789
skewness: -0.466934
Rendering intent: Perceptual
Gamma: 0.45455
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 4192x2666+0+0
Dispose: Undefined
Iterations: 0
Scene: 0 of 2
Compression: None
Orientation: TopLeft
Properties:
date:create: 2012-11-27T16:18:01+01:00
date:modify: 2012-11-27T16:18:01+01:00
exif:Contrast: 0
exif:CustomRendered: 0
exif:DateTimeDigitized: 2009:09:11 12:09:51
exif:DateTimeOriginal: 2009:09:11 12:09:51
exif:DigitalZoomRatio: 1
exif:ExposureBiasValue: -1
exif:ExposureMode: 0
exif:ExposureProgram: 2
exif:ExposureTime: 0.0166667
exif:Flash: 0
exif:FNumber: 5
exif:FocalLength: 42
exif:FocalLengthIn35mmFilm: 42
exif:ISOSpeedRatings: 1
exif:LightSource: 0
exif:MaxApertureValue: 4.2
exif:MeteringMode: 5
exif:Saturation: 0
exif:SceneCaptureType: 0
exif:SensingMethod: 2
exif:Sharpness: 0
exif:SubjectDistanceRange: 0
exif:SubSecTime: 32
exif:SubSecTimeDigitized: 32
exif:SubSecTimeOriginal: 32
exif:WhiteBalance: 0
MicrosoftPhoto:Rating: 0
signature: d33f535a53004733b4da916b8b321ec4c6a6698ef907627187c1c08eb7608441
tiff:artist:
tiff:copyright:
tiff:endian: lsb
tiff:make: NIKON CORPORATION
tiff:model: NIKON D700
tiff:photometric: RGB
tiff:rows-per-strip: 1
tiff:software: Capture NX 2.2.5 W
tiff:timestamp: 2011:10:03 09:53:18
xap:Rating: 0
Profiles:
Profile-icc: 8636 bytes
Nikon sRGB 4.0.0.3001
Profile-xmp: 2632 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 33.79MB
Number pixels: 11.18M
Pixels per second: 15.74MB
User time: 0.130u
Elapsed time: 0:01.710
Version: ImageMagick 6.7.5-7 2012-04-13 Q16 http://www.imagemagick.org
Image: DGT022430.TIF
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 160x101+0+0
Resolution: 300x300
Print size: 0.533333x0.336667
Units: PixelsPerInch
Type: TrueColor
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 2 (0.00784314)
max: 225 (0.882353)
mean: 124.934 (0.489936)
standard deviation: 38.1158 (0.149474)
kurtosis: 0.666595
skewness: -0.946985
Green:
min: 2 (0.00784314)
max: 228 (0.894118)
mean: 120.708 (0.473365)
standard deviation: 41.7781 (0.163836)
kurtosis: -0.165392
skewness: -0.321347
Blue:
min: 2 (0.00784314)
max: 238 (0.933333)
mean: 114.655 (0.449629)
standard deviation: 42.0264 (0.164809)
kurtosis: -0.317075
skewness: 0.0071084
Image statistics:
Overall:
min: 2 (0.00784314)
max: 238 (0.933333)
mean: 120.099 (0.470976)
standard deviation: 40.6794 (0.159527)
kurtosis: -0.0561564
skewness: -0.396018
Rendering intent: Perceptual
Gamma: 0.45455
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 160x101+0+0
Dispose: Undefined
Iterations: 0
Scene: 1 of 2
Compression: None
Orientation: TopLeft
Properties:
date:create: 2012-11-27T16:18:01+01:00
date:modify: 2012-11-27T16:18:01+01:00
signature: 1964b91ff47b2222ed8d682f41e7a6e48b3f93887d0226dd0438950b2fb0ffaf
tiff:endian: lsb
tiff:photometric: RGB
tiff:rows-per-strip: 17
Artifacts:
verbose: true
Tainted: False
Filesize: 33.79MB
Number pixels: 16.2K
Pixels per second: 11.5KB
User time: 1.300u
Elapsed time: 0:02.410
Version: ImageMagick 6.7.5-7 2012-04-13 Q16 http://www.imagemagick.org
identify: DGT022430.TIF: wrong data type 3 for "GainControl"; tag ignored. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/767.

snibgo
Posts: 12863
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIFF conversion errors

Post by snibgo »

As you can see, the file contains two images. One is 4192x2666, the other is 160x101. Maybe Photoshop recognises that one is the thumbnail of the other, so doesn't bother to show it.

Don't worry about "tag ignored" warnings.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26249
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TIFF conversion errors

Post by fmw42 »

Opening the image with photoshop I can see only one layer.
Anyway using convert image.tif[0] -thumbnail 200x200 thumb-image.jpg I get only one image, but I still get the error:
The reason to add [0], is to allow you to get only the first layer/page/frame.


Why don't you try to see what both images look like by converting to png or jpg as follows.



convert image.tif +adjoin image_%d.png

See what the two results look like and then get back to us.

Or add -strip and see if that helps

If none of this helps, then you will likely need to post a link to your image, so others can check it and test out commands.

jbogdani
Posts: 3
Joined: 2012-11-28T02:05:10-07:00
Authentication code: 6789

Re: TIFF conversion errors

Post by jbogdani »

snibgo wrote:As you can see, the file contains two images. One is 4192x2666, the other is 160x101. Maybe Photoshop recognises that one is the thumbnail of the other, so doesn't bother to show it.
I think you are right. It's an embedded thumbnail that Photoshop does not display. That's why the two output images had different quality.
Is it sure to add [0] to the image name for all images. I guess this will not make difference for 1 layer/page/frame images, but can produce fancy result with other files. Is it a good idea to always use -layers "flatten" option?
snibgo wrote:Don't worry about "tag ignored" warnings.
Using -quiet I'm able to turn warning off: the only way I have now to check if process was successful is to check if new image file exists.
fmw42 wrote: Using +adjoin and/or -strip does not change the result: jpg ang pnd do not support multiple images, so different images (dafault) are created.
I think in my case this issue can be solved by using -layers "flatten" -quiet options

snibgo
Posts: 12863
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIFF conversion errors

Post by snibgo »

"-quiet" should turn off warnings but not errors.

Using "-layers flatten" on this will place the thumbnail in the top-left of the full image. Which might be exactly what you want, of course.
snibgo's IM pages: im.snibgo.com

Post Reply