Project

General

Profile

Actions

Defect #33023

open

Warning occurs when displaying a few exceptional PDF thumbnail

Added by Anonymous about 4 years ago. Updated almost 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

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


Files

samplePDF.pdf (15.5 KB) samplePDF.pdf Anonymous, 2020-02-20 01:43
Actions #1

Updated by Go MAEDA about 4 years ago

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

Actions #2

Updated by Anonymous about 4 years ago

Here is a sample PDF.

Actions #3

Updated by Go MAEDA about 4 years 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
Actions #4

Updated by Anonymous about 4 years 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.

Actions #5

Updated by Anonymous almost 4 years ago

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

Actions #6

Updated by Go MAEDA almost 4 years ago

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

Actions #7

Updated by Anonymous almost 4 years 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.

Actions

Also available in: Atom PDF