Defect #33023

Warning occurs when displaying a few exceptional PDF thumbnail

Added by taca tadocolo 9 months ago. Updated 5 months ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Attachments
Target version:-
Resolution: Affected version:4.1.0

Description

A PDF thumbnail is displayed, but the following message is output to STDERR.
The PDF file cannot be published, but it was created with a fax image (binary image).

convert.exe: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG `redmine_root/tmp/thumbnails/***.thumb' @ warning/png.c/MagickPNGWarningHandler/1668.

The warning disappeared after applying the following patch.

--- a\lib\redmine\thumbnail.rb
+++ b\lib\redmine\thumbnail.rb
@@ -48,7 +48,7 @@
         size_option = "#{size}x#{size}>" 

         if is_pdf
-          cmd = "#{shell_quote CONVERT_BIN} #{shell_quote "#{source}[0]"} -thumbnail #{shell_quote size_option} #{shell_quote "png:#{target}"}" 
+          cmd = "#{shell_quote CONVERT_BIN} #{shell_quote "#{source}[0]"} -thumbnail #{shell_quote size_option} +profile icc #{shell_quote "png:#{target}"}" 
         else
           cmd = "#{shell_quote CONVERT_BIN} #{shell_quote source} -auto-orient -thumbnail #{shell_quote size_option} #{shell_quote target}" 
         end

Environment:
Redmine 4.1.0
ImageMagick 6.9.10-Q16

samplePDF.pdf (15.5 KB) taca tadocolo, 2020-02-20 01:43

History

#1 Updated by Go MAEDA 9 months ago

Thank you for reporting the issue. Could you provide a sample PDF file that causes the error?

#2 Updated by taca tadocolo 8 months ago

Here is a sample PDF.

#3 Updated by Go MAEDA 8 months ago

Thank you for providing the PDF file but I could not reproduce the issue. A thumbnail was generated without any error.

$ convert ~/Downloads/samplePDF.pdf[0] -thumbnail "200x200>" png:test.png
$ convert -version
Version: ImageMagick 7.0.8-25 Q16 x86_64 2019-01-30 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma png tiff webp xml zlib

#4 Updated by taca tadocolo 8 months ago

I tried ImageMagick 7.0.9-24 Q16, but still got the error.
No error occurs when adding the "+profile icc", "-strip" or "-quiet" parameter.

Adding info:
Ghostscript v9.21 or earlier got no errors, however v9.22 or later got errors.

#5 Updated by taca tadocolo 5 months ago

The same error occurs even with the latest Ghostscript ver9.52.

#6 Updated by Go MAEDA 5 months ago

The warning successfully reproduced with ImageMagick 7.0.10-14 and GhostScript 9.52. But is it OK to always remove ICC profile?

#7 Updated by taca tadocolo 5 months ago

Go MAEDA wrote:

The warning successfully reproduced with ImageMagick 7.0.10-14 and GhostScript 9.52. But is it OK to always remove ICC profile?

I don't know the side effects of adding the option "+profile icc".
I suggest adding the "-quiet" option instead of "+profile icc".
The "-quiet" option has the same effect.

Also available in: Atom PDF