Producing Bad JPEG while converting from Tif

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
Carter J
Posts: 116
Joined: 2013-12-19T02:20:09-07:00
Authentication code: 6789

Producing Bad JPEG while converting from Tif

Post by Carter J »

Hi,

While trying to convert a TIFF file to JPEG, the output is distorted and showing kind of x-ray effect.

Commands Used:

Code: Select all

convert -alpha off -units pixelsperinch -resample 150 inputImage.tif -profile USWebCoatedSWOP.icc -profile "sRGB Color Space Profile.icm" outputImage.jpg
and

Code: Select all

convert inputImage.tif outputImage.jpg
Input image cannot be uploaded, as it is customer specific..

Identify -verbose on Input Image is as follows:


Image: inputImage.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 2036x2920+0+0
Resolution: 300x300
Print size: 6.78667x9.73333
Units: PixelsPerInch
Type: ColorSeparation
Base type: TrueColor
Endianess: MSB
Colorspace: CMYK
Depth: 8-bit
Channel depth:
cyan: 8-bit
magenta: 8-bit
yellow: 8-bit
black: 1-bit
Channel statistics:
Cyan:
min: 0 (0)
max: 255 (1)
mean: 110.571 (0.433611)
standard deviation: 81.0452 (0.317824)
kurtosis: -1.11432
skewness: 0.399891
Magenta:
min: 0 (0)
max: 255 (1)
mean: 102.5 (0.401962)
standard deviation: 78.4236 (0.307543)
kurtosis: -0.955747
skewness: 0.509602
Yellow:
min: 0 (0)
max: 255 (1)
mean: 61.0106 (0.239257)
standard deviation: 73.8741 (0.289702)
kurtosis: 0.88142
skewness: 1.41161
Black:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 68.5204 (0.268708)
standard deviation: 67.4091 (0.264349)
kurtosis: 2.65489
skewness: 1.75628
Total ink density: 300%
Rendering intent: Perceptual
Gamma: 0.454545
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)
Background color: cmyk(255,255,255,0)
Border color: cmyk(223,223,223,0)
Matte color: cmyk(189,189,189,0)
Transparent color: cmyk(0,0,0,0)
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 2036x2920+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Orientation: TopLeft
Properties:
crs:AlreadyApplied: True
date:create: 2014-03-04T18:26:57+06:00
date:modify: 2014-03-04T06:14:58+06:00
dc:format: image/tiff
exif:ApertureValue: 2.52607
exif:BrightnessValue: 5.25921
exif:DateTimeDigitized: 2012:03:31 15:05:26
exif:DateTimeOriginal: 2012:03:31 15:05:26
exif:ExposureProgram: 2
exif:ExposureTime: 0.00833333
exif:Flash: 9
exif:FNumber: 2.4
exif:FocalLength: 4.28
exif:ISOSpeedRatings: 100
exif:MeteringMode: 5
exif:PixelXDimension: 2036
exif:PixelYDimension: 2920
exif:SensingMethod: 2
exif:ShutterSpeedValue: 6.90695
icc:copyright: Copyright 2000 Adobe Systems, Inc.
icc:description: U.S. Web Coated (SWOP) v2
icc:manufacturer: U.S. Web Coated (SWOP) v2
icc:model: U.S. Web Coated (SWOP) v2
jpeg:sampling-factor: 2x2
photoshop:ColorMode: 4
photoshop:DateCreated: 2012-03-31T15:05:26
photoshop:ICCProfile: U.S. Web Coated (SWOP) v2
signature: 3aab691b36f41d968cc9d18fbfc842a4dedc6a3e4f2e5a19002d0ee3cbb43924
stRef:documentID: xmp.did:B0334C160820681190F5BAAD40ECB57E
stRef:instanceID: xmp.iid:B4334C160820681190F5BAAD40ECB57E
stRef:originalDocumentID: xmp.did:B0334C160820681190F5BAAD40ECB57E
tiff:endian: msb
tiff:make: Apple
tiff:model: iPhone 4S
tiff:photometric: separated
tiff:rows-per-strip: 128
tiff:software: Adobe Photoshop CS5.1 Macintosh
tiff:timestamp: 2014:02:20 14:19:47
xmp:CreateDate: 2012-03-31T15:05:26-07:00
xmp:CreatorTool: Adobe Photoshop CS5.1 Macintosh
xmp:MetadataDate: 2014-02-20T14:19:47-05:00
xmp:ModifyDate: 2014-02-20T14:19:47-05:00
xmpMM:DocumentID: xmp.did:B0334C160820681190F5BAAD40ECB57E
xmpMM:InstanceID: xmp.iid:028011740720681180FF908DB0D36BBD
xmpMM:OriginalDocumentID: xmp.did:B0334C160820681190F5BAAD40ECB57E
Profiles:
Profile-8bim: 17094 bytes
Profile-icc: 557168 bytes
Profile-xmp: 21477 bytes
Artifacts:
filename: inputImage.tif
verbose: true
Tainted: False
Filesize: 4.855MB
Number pixels: 5.945M
Pixels per second: 25.3MB
User time: 0.234u
Elapsed time: 0:01.234
Version: ImageMagick 6.8.8-9 Q16 x64 2014-03-16 http://www.imagemagick.org


Any Insight?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Producing Bad JPEG while converting from Tif

Post by snibgo »

The metadata claims the image is CMYK, with a profile. Your commands should work. (Except that your first command should have "-alpha off -units pixelsperinch -resample 150" after "inputImage.tif", not before.)

However, I have seen images that claim to be CMYK but are actually sRGB, because there has been faulty processing that updated the pixels but not the metadata. To test this:

Code: Select all

convert inputImage.tif -set colorspace sRGB temp.tif
If temp.tif can now be viewed and processed as sRGB, that's the problem.
snibgo's IM pages: im.snibgo.com
Post Reply