error converting tif to pdf

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

error converting tif to pdf

Post by donswei »

I have tried a few times to no avail, I am getting this error on many files what are the arguments that I use to convert tif files to pdf.

Tif's are the majority of the converts that we need to do.

C:\mytest>magick 2679690.TIF 2679691.TIF ity.pdf
magick: Improper JPEG sampling factors 2,1
Apparently should be 1,1.. `JPEGPreDecode' @ error/tiff.c/TIFFErrors/572.

C:\mytest>magick 2679690.TIF abc.pdf
magick: Improper JPEG sampling factors 2,1
Apparently should be 1,1.. `JPEGPreDecode' @ error/tiff.c/TIFFErrors/572.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: error converting tif to pdf

Post by snibgo »

I suggest you provide a link to an input TIF that has the problem.

Please also state the version of IM you use, on what platform.
snibgo's IM pages: im.snibgo.com
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

Re: error converting tif to pdf

Post by donswei »

I am using ImageMagick 7.0.7 Q16 (64-bit) on windows if that helps.

I have to make a tif that I can share. we have sensitive information. I will have someone create one that we can share
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

Re: error converting tif to pdf

Post by donswei »

the link is to a file that gives us the error is

https://mcphsuniv-my.sharepoint.com/per ... %3a00.000Z
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: error converting tif to pdf

Post by snibgo »

With older versions of IM (6.9.5-3 and 7.0.3-5), I get a similar message, but as a warning, not an error, and it creates an output.

Code: Select all

f:\web\im>%IM%convert 2679693.TIF x.png
convert.exe: Auto-corrected former TIFF subsampling values [1,1] to match subsampling values inside JPEG compressed data [2,1]. `JPEGFixupTagsSubsamplingSec' @warning/tiff.c/TIFFWarnings/896.

f:\web\im>%IMG7%magick 2679693.TIF x.png
magick: Auto-corrected former TIFF subsampling values [1,1] to match subsampling values inside JPEG compressed data [2,1]. `JPEGFixupTagsSubsamplingSec' @ warning/tiff.c/TIFFWarnings/905.
snibgo's IM pages: im.snibgo.com
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

Re: error converting tif to pdf

Post by donswei »

In this version no pdf is created.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error converting tif to pdf

Post by fmw42 »

On IM 7.0.7.8 Q16 Mac OSX, I get the following message and no output.

Code: Select all

magick 2679693.TIF tmp.png
magick: Improper JPEG sampling factors 2,1
Apparently should be 1,1.. `JPEGPreDecode' @ error/tiff.c/TIFFErrors/645.
I note that the TIFF is JPEG encoded and the IM verbose information shows all pixels are 0

Image: 2679693.TIF
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 2200x1696+0+0
Resolution: 200x200
Print size: 11x8.48
Units: PixelsPerInch
Type: Bilevel
Base type: TrueColor
Endianess: LSB
Colorspace: sRGB
Depth: 8/1-bit
Channel depth:
gray: 1-bit
Channel statistics:
Pixels: 3731200
Gray:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: -3
skewness: 0
entropy: nan
Colors: 1
Histogram:
3731200: ( 0, 0, 0) #000000 gray(0)
...
Properties:
date:create: 2017-10-26T09:15:26-07:00
date:modify: 2017-10-26T09:15:26-07:00
jpeg:sampling-factor: 1x1
signature: 696ccf469a34023dac0df1c3897cdb6f1da68bafef3f85cdc37b43f164a2f6a5
tiff:alpha: unspecified
tiff:endian: lsb
tiff:photometric: YCBCR
tiff:rows-per-strip: 1696
tiff:software: LibTiff Version 4.0.3

So I conclude the image is corrupt or malformed or perhaps IM cannot handle JPEG encoded TIFF properly.


IM 6.9.9.20 Q16 Mac OSX, creates a totally black PNG
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

Re: error converting tif to pdf

Post by donswei »

I was able to open the fie in adobe fine. so at least adobe can open the file.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error converting tif to pdf

Post by fmw42 »

As a test, try importing the TIFF file into Photoshop or GIMP and export again with lzw or zip or no compression and again with JPG compression. Then convert them with ImageMagick and see if that works. I suspect the JPG 1:1 compression from wherever you got the TIFF file.

I can open the TIFF file in GIMP, but it says it is correcting the compression from 1:1 to 2:1. So I suspect that is the issue. Change the compression in some other tool so that the subsampling is 2:1.

Using GIMP to correct the file and exporting again as TIFF with JPG compression, then IM 7 opens and converts and saves the file with no problem.
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

Re: error converting tif to pdf

Post by donswei »

We tried that one one file, we exported on each lzw, zip, jpg and saved the file,
IM worked fine on each one . I can resave a few files so the conversion works for them but I have hundreds of files.
to me and others this shows IM should be able to handle the issue since photoshop worked.

I will start looking into how the files are saved to see if we can fix it going forward.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error converting tif to pdf

Post by fmw42 »

The problem is that it seems other programs like GIMP recognize that the format is non-standard and fix it. IM is apparently just checking and does giving an error without fixing it. This is not a bug per se, but a feature enhancement that you may need to ask about implementing. The bug is how the file was created. The IM developers will need to look into this to see if something can be done.
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

Re: error converting tif to pdf

Post by donswei »

we are seeing this in a fair amount of files and not sure if we can even fix it. we have scanners creating the tiff files, so getting them to adjust might be difficult.
how do we get someone to look into this?
and possibly fix this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error converting tif to pdf

Post by fmw42 »

Use the "contact us" button at the bottom of the forum to send a message to the IM developers to look into it.
donswei
Posts: 11
Joined: 2017-10-26T05:47:13-07:00
Authentication code: 1151

Re: error converting tif to pdf

Post by donswei »

I did the contact us twice and got no response.
I can do it a third time but I think the result will be the same.
we really need this fixed, how do we go about getting this updated?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: error converting tif to pdf

Post by fmw42 »

I sent a message to the IM developer to review this issue.
Post Reply