2

I am having some troubles in a script with convert command in ImageMagick package.

Here is the line :

convert $dst_folder/$1/$2/$3 -resize 144x144\> $thb_folder/$1/$2/$thb_picture

where $1 and $2 are folder names (year, month) and $3 is the file name

When executing the script, i have the following type of errors :

convert-im6.q16: unable to open image `/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0010.jpeg': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no images defined `/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0010-th.jpeg' @ error/convert.c/ConvertImageCommand/3258.
convert-im6.q16: unable to open image `/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0010.jpeg': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no images defined `/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0010-th.jpeg' @ error/convert.c/ConvertImageCommand/3258.

Obviously i checked that the file was there and with adequate rights:

ls -l /var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0010.jpeg
-rwxrwx--- 1 www-data www-all 1663905 Mar 20 12:55 /var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0010.jpeg

(the scripts in run with sudo). The -th file however is not created.

What is fun however is that the first executions of the line in the scripts often works (WA0008) ... until it starts to fail (WA0010):

generated thumbnail IMG-20220314-WA0008-th.jpeg for IMG-20220314-WA0008.jpeg (success)
convert-im6.q16: unable to open image `/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0010.jpeg': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no images defined `/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0010-th.jpeg' @ error/convert.c/ConvertImageCommand/3258.
convert-im6.q16: unable to open image `/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0010.jpeg': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no images defined `/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0010-th.jpeg' @ error/convert.c/ConvertImageCommand/3258.
chown: cannot access '/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0010-th.jpeg': No such file or directory
chmod: cannot access '/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0010-th.jpeg': No such file or directory

if i run the scripts again, this time the file WA0010 is correctly processed

generated thumbnail IMG-20220314-WA0010-th.jpeg for IMG-20220314-WA0010.jpeg (success)

I tried to use the `-limit memory 32' option but no improvement.

Below when i used `-debug all' on WA0008 but could not conclude:

2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: utility.c/ExpandFilenames/954/Configure
  Command line: convert {-debug} {all} {/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0008.jpeg} {-resize} {144x144>} {/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0008-th.jpeg}
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Policy convert-im6.q16[192323]: policy.c/IsRightsAuthorized/604/Policy
  Domain: Module; rights=Read; pattern="JPEG" ...
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: configure.c/GetConfigureOptions/685/Configure
  Searching for configure file: "/usr/share/ImageMagick-6/coder.xml"
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: configure.c/GetConfigureOptions/685/Configure
  Searching for configure file: "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10//config-Q16/coder.xml"
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: configure.c/GetConfigureOptions/685/Configure
  Searching for configure file: "/etc/ImageMagick-6/coder.xml"
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: configure.c/GetConfigureOptions/685/Configure
  Searching for configure file: "/usr/share/doc/imagemagick-6-common/htmlcoder.xml"
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: configure.c/GetConfigureOptions/685/Configure
  Searching for configure file: "/root/.config/ImageMagick/coder.xml"
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: configure.c/GetConfigureOptions/685/Configure
  Searching for configure file: "/root/.magick/coder.xml"
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Configure convert-im6.q16[192323]: coder.c/LoadCoderCache/818/Configure
  Loading coder configuration file "/etc/ImageMagick-6/coder.xml" ...
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Module convert-im6.q16[192323]: module.c/OpenModule/1300/Module
  Searching for module "JPEG" using filename "jpeg.la"
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Module convert-im6.q16[192323]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "jpeg.la" ...
2022-03-20T12:33:05+01:00 0:00.000 0.000u 6.9.10 Module convert-im6.q16[192323]: module.c/OpenModule/1309/Module
  Opening module at path "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10/modules-Q16/coders/jpeg.la"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Module convert-im6.q16[192323]: module.c/OpenModule/1336/Module
  Method "RegisterJPEGImage" in module "JPEG" at address 0x7ff1dd3d05b0
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Module convert-im6.q16[192323]: module.c/OpenModule/1350/Module
  Method "UnregisterJPEGImage" in module "JPEG" at address 0x7ff1dd3d08d0
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Policy convert-im6.q16[192323]: policy.c/IsRightsAuthorized/604/Policy
  Domain: Path; rights=Read; pattern="/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0008.jpeg" ...
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/usr/share/ImageMagick-6/locale.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10//config-Q16/locale.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/etc/ImageMagick-6/locale.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/usr/share/doc/imagemagick-6-common/htmllocale.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/root/.config/ImageMagick/locale.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/root/.magick/locale.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Configure convert-im6.q16[192323]: locale.c/LoadLocaleCache/1209/Configure
  Loading locale configure file "/usr/share/ImageMagick-6/locale.xml" ...
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/usr/share/ImageMagick-6/english.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10//config-Q16/english.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/etc/ImageMagick-6/english.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/usr/share/doc/imagemagick-6-common/htmlenglish.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/root/.config/ImageMagick/english.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Locale convert-im6.q16[192323]: locale.c/GetLocaleOptions/856/Locale
  Searching for locale file: "/root/.magick/english.xml"
2022-03-20T12:33:05+01:00 0:00.010 0.000u 6.9.10 Configure convert-im6.q16[192323]: locale.c/LoadLocaleCache/1209/Configure
  Loading locale configure file "/usr/share/ImageMagick-6/english.xml" ...
2022-03-20T12:33:05+01:00 0:00.010 0.010u 6.9.10 Exception convert-im6.q16[192323]: blob.c/OpenBlob/2874/Exception
  unable to open image `/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0008.jpeg': No such file or directory
2022-03-20T12:33:05+01:00 0:00.010 0.010u 6.9.10 Cache convert-im6.q16[192323]: cache.c/DestroyPixelCache/1182/Cache
  destroy 
2022-03-20T12:33:05+01:00 0:00.010 0.010u 6.9.10 Policy convert-im6.q16[192323]: policy.c/IsRightsAuthorized/604/Policy
  Domain: Path; rights=Read; pattern="/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0008.jpeg" ...
2022-03-20T12:33:05+01:00 0:00.010 0.010u 6.9.10 Exception convert-im6.q16[192323]: blob.c/OpenBlob/2874/Exception
  unable to open image `/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0008.jpeg': No such file or directory
2022-03-20T12:33:05+01:00 0:00.010 0.010u 6.9.10 Cache convert-im6.q16[192323]: cache.c/DestroyPixelCache/1182/Cache
  destroy 
2022-03-20T12:33:05+01:00 0:00.010 0.010u 6.9.10 Exception convert-im6.q16[192323]: convert.c/ConvertImageCommand/3258/Exception
  no images defined `/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0008-th.jpeg'
convert-im6.q16: unable to open image `/var/www/html/piwigo/galleries/2022/03_WH/IMG-20220314-WA0008.jpeg': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no images defined `/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0008-th.jpeg' @ error/convert.c/ConvertImageCommand/3258.
chown: cannot access '/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0008-th.jpeg': No such file or directory
chmod: cannot access '/var/www/html/piwigo/_data/i/galleries/2022/03_WH/IMG-20220314-WA0008-th.jpeg': No such file or directory

This looks like a bug in convert to me unless I am misusing it. Any idea how to solve this ?

Thanks

Gaspard
  • 31

1 Answers1

1

So finally the problem was solved by replacing

convert $dst_folder/$1/$2/$3 -resize 144x144\> $thb_folder/$1/$2/$thb_picture 

by

convert $dst_folder/$1/$2/$3 -thumbnail '144x144>' $thb_folder/$1/$2/$thb_picture

However this does not explain why I had some problem with the resize option.

Cheers

Gaspard
  • 31