PDF With different page sizes loads wrong in IM

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.
Post Reply
bheam

PDF With different page sizes loads wrong in IM

Post by bheam »

Version: ImageMagick 6.3.5 09/28/07 Q16 http://www.imagemagick.org

Code: Select all

# identify test.pdf

   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****

   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****

   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> Adobe PDF Library 7.0 <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

test.pdf[0] PDF 595x842 595x842+0+0 DirectClass 16-bit 11.9454mb 1.700u 0:03
test.pdf[1] PDF 595x842 595x842+0+0 DirectClass 16-bit 11.9454mb 1.470u 0:02
test.pdf[2] PDF 595x842 595x842+0+0 DirectClass 16-bit 11.9454mb 1.250u 0:02
test.pdf[3] PDF 595x842 595x842+0+0 PseudoClass 256c 16-bit 11.9454mb 1.020u 0:02
test.pdf[4] PDF 595x842 595x842+0+0 DirectClass 16-bit 11.9454mb 0.990u 0:02
test.pdf[5] PDF 595x842 595x842+0+0 PseudoClass 256c 16-bit 11.9454mb 0.710u 0:02
test.pdf[6] PDF 595x842 595x842+0+0 PseudoClass 256c 16-bit 11.9454mb 0.690u 0:02
test.pdf[7] PDF 595x842 595x842+0+0 PseudoClass 256c 16-bit 11.9454mb 0.650u 0:02
test.pdf[8] PDF 595x842 595x842+0+0 PseudoClass 256c 16-bit 11.9454mb 
test.pdf[9] PDF 595x842 595x842+0+0 PseudoClass 256c 16-bit 11.9454mb 
test.pdf[10] PDF 595x842 595x842+0+0 PseudoClass 256c 16-bit 11.9454mb 
test.pdf[11] PDF 595x842 595x842+0+0 DirectClass 16-bit 11.9454mb 
test.pdf[12] PDF 595x842 595x842+0+0 DirectClass 16-bit 11.9454mb 
As you can see, IM lists all pages as same size, here's what ghostscript says (v 8.60):

Code: Select all

# /usr/local/bin/gs -dNODISPLAY -q -sFile=test.pdf -dDumpMediaSizes pdf_info.ps

test.pdf has 13 pages.
Creator: Adobe InDesign CS2 (4.0.4)
Producer: Adobe PDF Library 7.0
CreationDate: D:20070917142453+02'00'
ModDate: D:20070917142602+02'00'
Trapped: False

Page 1 MediaBox: [ 595.276 841.89 ] CropBox: [ 595.276 841.89 ]
Page 2 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 3 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 4 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 5 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 6 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 7 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 8 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 9 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 10 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 11 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 12 MediaBox: [ 1190.55 841.89 ] CropBox: [ 1190.55 841.89 ]
Page 13 MediaBox: [ 595.276 841.89 ] CropBox: [ 595.276 841.89 ]
Ghostscript is correct, IM is wrong. Is there a way to circumvent this behaviour or is it a bug that needs fixing?

Kind regards,

Michael
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF With different page sizes loads wrong in IM

Post by magick »

Can you post a URL to your PDF image so we can download it and test. An enhancement is required to ImageMagick to be able to handle different page sizes.
bheam

Re: PDF With different page sizes loads wrong in IM

Post by bheam »

http://www.omnijoy.com/demo/flash/test3.pdf

Thanks for quick response :)

Edit: web optimized the file to half size (now 2.2mb)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF With different page sizes loads wrong in IM

Post by magick »

We're using ImageMagick 6.3.5-10 with Ghostscript 8.60. ImageMagick returns these attributes:
  • test3.pdf[0] PDF 1191x842 1191x842+0+0 DirectClass 16-bit 23.91mb 0.900u 0:02
    test3.pdf[1] PDF 1191x842 1191x842+0+0 DirectClass 16-bit 23.91mb 0.820u 0:02
    test3.pdf[2] PDF 1191x842 1191x842+0+0 DirectClass 16-bit 23.91mb
    test3.pdf[3] PDF 1191x842 1191x842+0+0 PseudoClass 256c 16-bit 23.91mb
    test3.pdf[4] PDF 1191x842 1191x842+0+0 DirectClass 16-bit 23.91mb
    test3.pdf[5] PDF 1191x842 1191x842+0+0 PseudoClass 256c 16-bit 23.91mb
    test3.pdf[6] PDF 1191x842 1191x842+0+0 PseudoClass 256c 16-bit 23.91mb
    test3.pdf[7] PDF 1191x842 1191x842+0+0 PseudoClass 256c 16-bit 23.91mb
    test3.pdf[8] PDF 1191x842 1191x842+0+0 PseudoClass 256c 16-bit 23.91mb
    test3.pdf[9] PDF 1191x842 1191x842+0+0 PseudoClass 256c 16-bit 23.91mb
    test3.pdf[10] PDF 1191x842 1191x842+0+0 PseudoClass 256c 16-bit 23.91mb
    test3.pdf[11] PDF 1191x842 1191x842+0+0 DirectClass 16-bit 23.91mb
    test3.pdf[12] PDF 1191x842 1191x842+0+0 DirectClass 16-bit 23.91mb
It takes the largest page size and sets the image size to that value. ImageMagick currently cannot distinquish individual page sizes.
bheam

Re: PDF With different page sizes loads wrong in IM

Post by bheam »

Hi again,

It seems my editing the file to reduce file size changed more than that. It now behaves as you say (All pages equal largest size), however the original (test.pdf) does not.

The original behaved like you said when i used "ImageMagick-6.2.9-8.i386.rpm" but i've upgraded since...

Now i use "ImageMagick-6.3.5-10.tar.gz" and http://www.omnijoy.com/demo/flash/test.pdf and the results are as i reported.

Any ideas?

Michael
bheam

Re: PDF With different page sizes loads wrong in IM

Post by bheam »

Could anyone point me to where in the code this size detection is being made? i tried looking into coders/pdf.c but as far as i can tell, everything there is correct - the actual image rendering and page size setting is done somewhere else?
Post Reply