Page 1 of 2
Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-05T11:43:46-07:00
by sbleon
Hi! I'm converting one-page PDFs to TIFF files, and the tool that consumes the TIFFs is *very* picky about its input. The TIFF I'm creating is being rejected by this tool with the spurious error message:
Code: Select all
TIFF is not uncompressed 1 bit or compressed using CCITT G4. File is ignored.
I say this message is spurious because my TIFF file has "Compression: Group4".
By using "identify -verbose" on a previously-converted, working TIFF and on the broken one that I've converted, I can see that all properties are identical (excepting expected differences like the histogram data, filename, hash, etc) except that the broken one has a Chromaticity section and the working one does not. The Chromaticity section is identical to that of the input PDF file.
The only way I've been able to create a working TIFF is with GraphicConverter, and I'd much rather use the free CLI tool to the job.
How can I remove the Chromaticity section from the TIFF file?
For reference, here's the command I'm using:
Code: Select all
convert -density 500 -units PixelsPerInch -strip Downloads/ACBYX.pdf[0] -monochrome -resize 4125x5338 -compress Group4 Downloads/ACBYX.tif
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-05T11:47:58-07:00
by fmw42
Have you considered other free tools to extract the embedded image from within the PDF shell? IM cannot do that, but other tools can. See pdfimages discussed at
http://www.imagemagick.org/Usage/formats/#ps.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-05T11:50:22-07:00
by sbleon
Thanks, @fmw42. The PDF actually contains mostly text, so there's no image for me to extract. I'm using ghostscript (automatically via ImageMagick) to render the text to an image.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-05T11:58:37-07:00
by fmw42
sbleon wrote:Thanks, @fmw42. The PDF actually contains mostly text, so there's no image for me to extract. I'm using ghostscript (automatically via ImageMagick) to render the text to an image.
OK. Sorry for my confusion. I do not know how to remove chromaticity information. I suspect that is not the issue, but do not know what is. Can you post an example PDF that you want to convert. I have GraphicConverter also, so assume you are on a Mac.
What version of IM are you using? Is your Ghostscript up to date?
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-05T20:16:37-07:00
by fmw42
convert -density 500 -units PixelsPerInch -strip Downloads/ACBYX.pdf[0] -monochrome -resize 4125x5338 -compress Group4 Downloads/ACBYX.tif
Try putting -monochrome after -resize. Resize will interpolate values and thus the bilevel status will change to grayscale. Putting it after the resize will leave your result as bi-level.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-06T13:53:29-07:00
by sbleon
Yes! Win! Thanks, Fred!!! That did the trick! The old, crusty PDF generator I'm using now happily incorporates these TIFF files
Code: Select all
convert -density 500 -units PixelsPerInch ACBYX.pdf[0] -background white -alpha remove -resize 4125x5338 -monochrome -compress Group4 ACBYX.tif
(I also had to remove the alpha channel and use a white background to avoid a large black border around the image.)
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-06T14:07:21-07:00
by fmw42
-monochrome is an operator not a setting. Settings typically precede the operator that needs to use them, but can often precede everything but the convert. Operators, typically need to be specified in proper order. That is they can be order dependent as is the case here.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-13T09:57:38-07:00
by sbleon
So this was working great with ImageMagick 6.9.0-10. In trying to get another person set up to do these conversions, we found that TIFFs generated using 6.9.2-10 do not work, and they include the Chromaticity section that we had successfully gotten rid of before.
`identify -verbose` output from 6.9.0
Code: Select all
Image: ABSYX_leon.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 4125x5338+0+0
Resolution: 500x500
Print size: 8.25x10.676
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: LSB
Colorspace: Gray
Depth: 1-bit
Channel depth:
gray: 1-bit
Channel statistics:
Pixels: 22019250
Gray:
min: 0 (0)
max: 1 (1)
mean: 0.942466 (0.942466)
standard deviation: 0.232859 (0.232859)
kurtosis: 12.4422
skewness: -3.80029
entropy: 0.535885
Colors: 2
Histogram:
1266846: ( 0, 0, 0) #000000 gray(0)
20752404: (255,255,255) #FFFFFF gray(255)
Rendering intent: Undefined
Gamma: 0.454545
Background color: gray(255)
Border color: gray(223)
Matte color: gray(189)
Transparent color: gray(0)
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 4125x5338+0+0
Dispose: Undefined
Iterations: 0
Compression: Group4
Orientation: TopLeft
Properties:
date:create: 2016-01-13T11:26:37-05:00
date:modify: 2016-01-13T11:26:37-05:00
signature: a7882a86c8a51ca825f792c1b5901c0bf336c469f479f437f75c1e60ce02d31a
tiff:alpha: unspecified
tiff:endian: lsb
tiff:photometric: min-is-white
tiff:rows-per-strip: 5338
Artifacts:
filename: ABSYX_leon.tif
verbose: true
Tainted: False
Filesize: 209KB
Number pixels: 22.02M
Pixels per second: 1.04853TB
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.9.0-10 Q16 x86_64 2015-03-24 http://www.imagemagick.org
`identify -verbose` output from 6.9.2
Code: Select all
Image: ABSYX_leon4.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 4125x5338+0+0
Resolution: 500x500
Print size: 8.25x10.676
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: LSB
Colorspace: Gray
Depth: 1-bit
Channel depth:
gray: 1-bit
Channel statistics:
Pixels: 22019250
Gray:
min: 0 (0)
max: 1 (1)
mean: 0.942422 (0.942422)
standard deviation: 0.232943 (0.232943)
kurtosis: 12.4289
skewness: -3.79854
entropy: 0.536003
Colors: 2
Histogram:
1267820: ( 0, 0, 0) #000000 gray(0)
20751430: (255,255,255) #FFFFFF gray(255)
Rendering intent: Undefined
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: gray(255)
Border color: gray(223)
Matte color: gray(189)
Transparent color: gray(0)
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 4125x5338+0+0
Dispose: Undefined
Iterations: 0
Compression: Group4
Orientation: TopLeft
Properties:
date:create: 2016-01-13T11:41:58-05:00
date:modify: 2016-01-13T11:41:58-05:00
signature: 6d951ef821693a8f744ac91377837d4921419b49da283917571c54eded3320b0
tiff:alpha: unspecified
tiff:endian: lsb
tiff:photometric: min-is-white
tiff:rows-per-strip: 5338
Artifacts:
filename: ABSYX_leon4.tif
verbose: true
Tainted: False
Filesize: 209KB
Number pixels: 22.02M
Pixels per second: 1.22329TB
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.9.2-10 Q16 x86_64 2016-01-13 http://www.imagemagick.org
We want to be able to use the newest ImageMagick, of course. Any ideas about what 6.9.2 might be doing differently than 6.9.0?
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-13T10:06:27-07:00
by fmw42
check the changelog at
http://www.imagemagick.org/script/changelog.php to see if there is any mention of anything related to changes in TIFF between those releases.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-13T10:09:41-07:00
by sbleon
Yeah, I should have mentioned that I checked the changelog. I saw a few TIFF-related items, but nothing that seemed obviously related to my issue.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-13T10:45:24-07:00
by sbleon
6.9.1-10 doesn't work for me either. That narrows things down a bit, but I don't see any obvious culprits in the changelog between 6.9.0-10 and 6.9.1-10.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-13T13:09:34-07:00
by fmw42
Provide your PDF and I will try to pin down the exact release where it changed. Did you try to put the strip again after reading the PDF?
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-14T13:13:40-07:00
by sbleon
Fred, you're the best! You can download the PDF from
http://singlebrook.com/system/resources ... /ABSYX.pdf
I tried adding `-strip` after the `ABSYX.pdf[0]`, but that did not change anything. Chromaticity still stubbornly shows up.
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-14T16:14:01-07:00
by fmw42
I get the Chromaticity for 6.9.0.10!
Code: Select all
im69010 identify ABSYX.pdf
Image: ABSYX.pdf
Format: PDF (Portable Document Format)
Mime type: application/pdf
Class: DirectClass
Geometry: 612x792+0+0
Resolution: 72x72
Print size: 8.5x11
Units: Undefined
Type: PaletteAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 16/8-bit
...
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: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 612x792+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Properties:
date:create: 2016-01-14T15:09:55-08:00
date:modify: 2016-01-14T15:09:55-08:00
pdf:HiResBoundingBox: 612x792+0+0
pdf:Version: PDF-1.4 1 0 obj <<
signature: 8bfec2c4b9782a1c3f1d054fb729fab3199508b9d402f02d99d5f254d04e2eb4
Artifacts:
filename: ABSYX.pdf
verbose: true
Tainted: False
Filesize: 82.9KB
Number pixels: 485K
Pixels per second: 242.35GB
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.9.0-10 Q16 x86_64 2016-01-14 http://www.imagemagick.org
Perhaps the difference is what version of Ghostscript you are using. On my system I have
Perhaps you have an older version on your system for your 6.9.0.10 but a newer one on your 6.9.1.10
Re: Remove Chromaticity info in PDF->TIFF
Posted: 2016-01-15T11:38:54-07:00
by sbleon
Fred, thanks for checking that. I also get the Chromaticity when I run identify on the PDF with 6.9.0, but I don't see Chromaticity on the converted TIFF with 6.9.0. 6.9.0 manages to remove it, whereas the later versions leave it in place.
I'm using the same version of Ghostscript in all cases (9.15).