Can not convert pdf to tiff with jpeg conversion

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
gmr
Posts: 8
Joined: 2013-07-15T02:54:33-07:00
Authentication code: 6789

Can not convert pdf to tiff with jpeg conversion

Post by gmr »

Hi,

I am running imagemagick 6.8.3-5 on an solaris11 machine.

# convert --version
Version: ImageMagick 6.8.3-5 2013-08-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib fftw freetype jng jpeg lcms lzma openexr pango png ps tiff x xml zlib

The problem is, I am not able to convert pdf into tiff with jpeg compression. Is this a limitation of imagemagick or am I doing something wrong here?

# convert mozilla.pdf -compress JPEG mozilla2.tiff
convert: BitsPerSample 16 not allowed for JPEG. `JPEGSetupEncode' @ error/tiff.c/TIFFErrors/562.

I was able convert from jpg to tiff using jpeg conversion though. Could someone help me out here, please? Am I missing something here??

Thanks in Advance!
gmr
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can not convert pdf to tiff with jpeg conversion

Post by fmw42 »

It appears that you cannot compress 16-bit data with jpg compression. Looks like libtiff does not allow that.

try

convert mozilla.pdf -depth 8 -compress JPEG mozilla2.tiff
gmr
Posts: 8
Joined: 2013-07-15T02:54:33-07:00
Authentication code: 6789

Re: Can not convert pdf to tiff with jpeg conversion

Post by gmr »

Thanks for the tip. I also found similar posts on web. I tried the following. But I am still not able convert it successfully.

$ convert testsample2.pdf -compress JPEG testsample2.tiff
convert: BitsPerSample 16 not allowed for JPEG. `JPEGSetupEncode' @ error/tiff.c/TIFFErrors/562.
$ convert testsample2.pdf -depth 8 -compress JPEG testsample2.tiff
convert: Bogus input colorspace. `JPEGLib' @ error/tiff.c/TIFFErrors/562.
$ identify -verbose testsample2.pdf | grep 'Colorspace'
Colorspace: sRGB
Colorspace: sRGB
Colorspace: sRGB
Colorspace: sRGB
$ convert testsample2.pdf -depth 8 -colorspace sRGB -compress JPEG testsample2.tiff
convert: Bogus input colorspace. `JPEGLib' @ error/tiff.c/TIFFErrors/562.
$

Any suggestions how to tackle the latest error?

Thanks in advance!
gmr
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Can not convert pdf to tiff with jpeg conversion

Post by magick »

Try upgrading your release of ImageMagick and libTIFF. Converting from PDF to TIFF worked without complaint for us with ImageMagick 6.8.8-1 and LIBTIFF, Version 4.0.3.
gmr
Posts: 8
Joined: 2013-07-15T02:54:33-07:00
Authentication code: 6789

Re: Can not convert pdf to tiff with jpeg conversion

Post by gmr »

I am running 6.8.3-5.

$ convert -version
Version: ImageMagick 6.8.3-5 2013-08-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib fftw freetype jng jpeg lcms lzma openexr pango png ps tiff x xml zlib
$

Does that mean, the version that I am using doesn't support the attempted conversion?

Thanks!
gmr.
gmr
Posts: 8
Joined: 2013-07-15T02:54:33-07:00
Authentication code: 6789

Re: Can not convert pdf to tiff with jpeg conversion

Post by gmr »

I am running libtiff-3.9.5.

I am just trying to understand whether this issue is due to wrong conversion specifiers or the limitation of imagemagick itself.

Thanks!
gmr
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can not convert pdf to tiff with jpeg conversion

Post by snibgo »

According to http://en.wikipedia.org/wiki/JPEG there is a 12-bit JPEG format, "but this format is not as widely supported."

Current IM (v6.8.8-0) silently converts 16-bit/channel images to 8-bit. Eg:

Code: Select all

convert -size 1x1000 gradient: -depth 16 -compress jpeg t.tiff
identify -verbose shows the result is 8-bit.
snibgo's IM pages: im.snibgo.com
Post Reply