Page MenuHomePhabricator

Error creating PDF on Commons: "convert: no decode delegate for this image format" (fixed in GS 9.07)
Closed, ResolvedPublic

Description

David Cuenca reports on mediawiki-l that a PDF from Google docs does not render on Commons. See http://thread.gmane.org/gmane.org.wikimedia.mediawiki/41507 for his message.

The PDF's URL is: https://commons.wikimedia.org/wiki/File:Interproject_links_tabbed_interface_proposal_presentation.pdf

Visiting a thumbnail's URL (https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Interproject_links_tabbed_interface_proposal_presentation.pdf/page1-800px-Interproject_links_tabbed_interface_proposal_presentation.pdf.jpg) reveals the following error message:

Error generating thumbnail

Error creating thumbnail: convert: no decode delegate for this image format `/tmp/magick-STzEaZl6' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `/tmp/transform_d32a7a881ee9-1.jpg' @ error/convert.c/ConvertImageCommand/3011.


Version: unspecified
Severity: normal

Details

Reference
bz48007

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:32 AM
bzimport set Reference to bz48007.
bzimport added a subscriber: Unknown Object (MLST).

Same error for https://commons.wikimedia.org/wiki/File:Cox_and_box.pdf

Error creating thumbnail: convert: no decode delegate for this image format `/tmp/magick-09CMSXr6' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `/tmp/transform_85fdac282e66-1.jpg' @ error/convert.c/ConvertImageCommand/3011.

Split from list in bug 41665 comment 2

Ghostscript not liking the file.

bawolff@Bawolff-L:~$ gs Interproject_links_tabbed_interface_proposal_presentation.pdf
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 14.
Page 1
Error: /rangecheck in --run--
Operand stack:

--dict:8/17(L)--

Execution stack:

%interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   1861   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   14   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   --nostringval--

Dictionary stack:

--dict:1153/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:108/127(ro)(G)--   --dict:290/300(ro)(G)--   --dict:22/25(L)--   --dict:6/8(L)--   --dict:21/40(L)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--   --dict:5/5(L)--

Current allocation mode is local
Last OS error: 11
GPL Ghostscript 8.71: Unrecoverable error, exit code 1

otoh, ImageMagick seemed to be ok locally when I tried convert.

bawolff@Bawolff-L:~$ convert --version
Version: ImageMagick 6.6.0-4 2010-11-16 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP


So possibly something that could be fixed on update.

I have submitted the bug to the Ghostscript bugzilla:
http://bugs.ghostscript.com/show_bug.cgi?id=694536

Thanks for trying!

Upstream ticket closed as INVALID: "Please try the current version of Ghostscript and, if the problem persists, reopen the bug report."

Cannot reproduce the problem with 9.07 on Fedora 19:

$:andre\> gs ~/Desktop/Interproject_links_tabbed_interface_proposal_presentation.pdf
GPL Ghostscript 9.07 (2013-02-14)
Copyright (C) 2012 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 14.
Page 1

showpage, press <return> to continue<<

[...]
Page 14

showpage, press <return> to continue<<

GS>quit
$:andre\>

I apologize, I should have mentioned my version of ghostscript is insanely old. I imagine the version on production is fairly old to.

I guess this puts this ticket in ops territory - upgrade ghostscript and/or image magick

(In reply to comment #8)

Could you please fix this bug? Thanks, Yann

See comment 6 and comment 7. Fixing the PDF file instead should be easier.

Yann added a comment.Dec 16 2013, 2:43 PM

https://commons.wikimedia.org/wiki/File:Jaur%C3%A8s_-_De_la_realite_du_monde_sensible.pdf

There is no problem displaying this file locally (AReader XI), so I don't understand your answer. Regards, Yann

Well, corrupt JPX streams might still be parseable by Adobe's decoder...

$:andre\> gs Jaurès_-_De_la_realite_du_monde_sensible.pdf
GPL Ghostscript 9.10 (2013-08-30)
Copyright (C) 2013 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 450.
Page 1

  • ERROR: Unable to process JPXDecode data. Page will be missing data.
  • ERROR: Unable to process JPXDecode data. Page will be missing data.

https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/FastCCI_-_Taming_the_Commons_Category_Tree.pdf/page1-200px-FastCCI_-_Taming_the_Commons_Category_Tree.pdf.jpg?blah

Error generating thumbnail

Error creating thumbnail: **** Error reading a content stream. The page may be incomplete.
convert: no decode delegate for this image format `/tmp/magick-2P3awEZB' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `/tmp/transform_bec33f9bb3e6-1.jpg' @ error/convert.c/ConvertImageCommand/3011.

daniel wrote:

The file in the comment above was created by printing to PDF from Google chrome on Mac. It does not strike me as a fringe issue.

All of the linked files except for the last one thumbnail correctly for me. We're running Ghostscript 9.10 in production these days.

https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/FastCCI_-_Taming_the_Commons_Category_Tree.pdf/page1-200px-FastCCI_-_Taming_the_Commons_Category_Tree.pdf.jpg?blah
Error generating thumbnail
Error creating thumbnail: **** Error reading a content stream. The page may be incomplete.
convert: no decode delegate for this image format `/tmp/magick-2P3awEZB' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `/tmp/transform_bec33f9bb3e6-1.jpg' @ error/convert.c/ConvertImageCommand/3011.

This looks like a different error message, and funnily only appears for the first page on the PDF. Filed as T110852.

Restricted Application added subscribers: Steinsplitter, Matanya. · View Herald TranscriptAug 30 2015, 10:05 PM
matmarex closed this task as Resolved.Aug 30 2015, 10:05 PM
matmarex set Security to None.

Is this another bug?

Yes - see the error messages you get for those thumbnails.

Seb35 added a subscriber: Seb35.Mar 20 2019, 2:16 PM

FYI I have this error message on some PDF scans (on a private wiki). The issue is with Ghostscript 9.26, who writes the following error message at the beginning of the file (before the JPEG real content):

**** Error: stream operator isn't terminated by valid EOL.
            Output may be incorrect.

The user-displayed error is ImageMagick who does not understand the JPEG image (which is normal). Hence it is not a MediaWiki or an ImageMagick issue, but a Ghostscript’s one. If I find something useful to solve it, I will report it here if anyone else has this issue in the recent days.

Schtom added a subscriber: Schtom.May 23 2019, 3:53 PM

ubtuntu 16.04
imagemagick: Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28
ghostscript: 9.26

i have the same issue. on a private wiki a client uploaded a pdf scanned with an HP laserjet. the error message i get is

no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. convert: no images defined `/tmp/transform_82d28da241a8.jpg' @ error/convert.c/ConvertImageCommand/3210.

gs also outputs the same error as mentioned above by @Seb35; imagemagick does too during conversion.

i ran

convert pdffile.pdf test.jpg && identify test-0.jpg | grep "corrupt"

with no console output which shows that the image generated is valid jpg, right?

NB: locally i tested with gs 9.26 and ImageMagick 6.9.9-38 Q16 x86_64 and no error was printed; i did not test this setting on the wiki server

matmarex removed a subscriber: matmarex.May 23 2019, 4:27 PM

i ran

convert pdffile.pdf test.jpg && identify test-0.jpg | grep "corrupt"

with no console output which shows that the image generated is valid jpg, right?

Did you attempt to view the file?

Schtom added a comment.EditedMay 29 2019, 4:44 PM

yes i did. i didn't recognize anything wrong with the image file. i used gnome's image viewer.

so here's a reproducable case.

  • os: alpine 3.8
  • mediawiki 1.32.1
  • php 7.2.18 (fpm-fcgi)
  • extension: pdf handler (img preview works with other files, e.g. the cox and box.pdf linked above)
  • $wgMaxShellMemory = 0;
  • $wgMaxShellTime = 0;
  • gs 9.26
  • imagemagick 7.0.8-38 Q16 x86_64 2019-04-15

after running (see SO)

pdftocairo -pdf corrupt.pdf repaired.pdf

gs parsed the pdf correctly and the pdf preview worked;