Post view

ImageMagick 7.0.6-6奇怪的錯誤訊息:warning/png.c/MagickPNGWarningHandler/1744

我在macOS Server的Console程式裡面的apache2的error_log發現大量由convert指令產生的錯誤訊息!

錯誤訊息的內容除了「139609.png」的圖形檔案名稱不同以外,其他都完全相同!我只列出其中的5個,事實上全部高達1725個完全相同的錯誤訊息!

 

convert: profile 'icc': C44h: length does not match profile `insoler/modules/boonex/photos/data/files/histogramcolor139609.png' @ warning/png.c/MagickPNGWarningHandler/1744.
convert: profile 'icc': C44h: length does not match profile `insoler/modules/boonex/photos/data/files/histogramcolor139610.png' @ warning/png.c/MagickPNGWarningHandler/1744.
convert: profile 'icc': C44h: length does not match profile `insoler/modules/boonex/photos/data/files/histogramcolor139613.png' @ warning/png.c/MagickPNGWarningHandler/1744.
convert: profile 'icc': C44h: length does not match profile `insoler/modules/boonex/photos/data/files/histogramcolor139614.png' @ warning/png.c/MagickPNGWarningHandler/1744.
convert: profile 'icc': C44h: length does not match profile `insoler/modules/boonex/photos/data/files/histogramcolor139611.png' @ warning/png.c/MagickPNGWarningHandler/1744.

 

這個convert指令,其實是用在上傳照片以後的「非同步處理」的PHP程式碼裡面,負責製作色階分佈圖的指令。這個不斷產生錯誤訊息的convert指令並不是mac OS 10.11或是10.12,或是所有Mac OS X內建的指令!而是我另外安裝ImageMagick程式,被安裝的其中一個指令。

ImageMagick號稱是指令列版本的Photoshop,可以用許多指令處理各種圖形。我用關鍵字「MagickPNGWarningHandler」找到這一篇討論:

"Ignoring invalid time value" when writing PNGs

Using ImageMagick 7.0.6-6 Q16 x64 HDRI on Windows 10. When I run this command...
CODE: SELECT ALL
magick logo: test.png
I get this warning...
CODE: SELECT ALL
magick: Ignoring invalid time value `test.png' @ warning/png.c/MagickPNGWarningHandler/1744.
The same warning is issued when I use other IM native images like "gradient:" or "label:" as input images and save as a PNG.

I also get that warning sometimes if I use a PNG image as input and save as a PNG, but it doesn't always happen, and I haven't figured out what triggers it.

他使用的是「Windows 10」,但是我使用的是Mac OS X 10.11.6。

"Ignoring invalid time value" error is not solved

Discussion also here. This bug still exists in 7.0.6.7 and 6.9.9-7.

This bug appears only at certain time of day! Using OS-X Sierra. Currently it is 2.30pm Amsterdam time and the bug does not appear. However if I set the time on my clock to 10.30pm, I immediately get this error when read + writing a png file.

Perhaps the problem is triggered when the UTC date is different from the local date?

I:\>convert logo: -define date:modify=2017-09-10T20:35:00+03:30 test.png
convert: Ignoring invalid time value `test.png' @ warning/png.c/MagickPNGWarningHandler/1744.

很顯然他使用「OS-X Sierra」也就是macOS 10.12也同樣遇到與Windows 10相同的錯誤訊息!很顯然這不是OS作業系統的問題,而是ImageMagick 7.0.6-6的問題!

幸好我在升級到新的版本以前,有事先備份舊的版本,所以我懶的等待ImageMagick發表新版本修復這個bug,直接移除整個模組,全部扔到垃圾桶,再從事先備份舊的版本的 .zip 壓縮檔案解壓縮,然後copy到 /usr/local/ 檔案夾,再修改php.ini使用舊版的ImageMagick,再重新啟動Web Server,就可以回到2016-01-08發表的ImageMagick 6.9.3-0版本。我不在乎舊版有沒有其他的安全性漏洞,反正ImageMagick只是用來製作JPEG縮圖、製作色階分佈圖,並沒有其他的用途。技術再好的駭客,也絕對不可能利用ImageMagick入侵網站!

 

imagick module enabled
imagick module version  3.3.0 
imagick classes  Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel 
Imagick compiled with ImageMagick version  ImageMagick 6.9.3-0 Q16 x86_64 2016-01-08 http://www.imagemagick.org 
Imagick using ImageMagick library version  ImageMagick 6.9.3-0 Q16 x86_64 2016-01-08 http://www.imagemagick.org 
ImageMagick copyright  Copyright (C) 1999-2016 ImageMagick Studio LLC 
ImageMagick release date  2016-01-08 

 

一個人要管理一個社群網站,還要解決許多原本不需要解決的問題,實在是很累。

蘇言霖 2017/09/22 0 1254
Comments
Order by: 
Per page:
 
  • There are no comments yet
Rate
0 votes
Post info
蘇言霖
「超級懶貓級」社群網站站長
2017/09/22 (2380 days ago)
Actions