I'm trying to port a PHP script to Ruby and until now I only used ImageMagick to convert from one file-format to another. Meaning: Yes, I'm an ImageMagick newbie. ;-)
Somewhere inside the PHP script the following code is executed:
$output = array();
$returnValue = 0;
$cmd = 'convert '.$pngFile->path.' -resize 1x1 -alpha on -channel o -format "%[fx:u.a]" info:'
exec($cmd, $output, $returnValue);
Using the ImageMagick documentation for convert I identified the following options:
-resize 1x1
Resize to 1x1 pixels (right?)-alpha on
Activate alpha-channel-channel o
Apply options to the opacity image-channel
My questions:
- What does
-format "%[fx:u.a]"
exactly do? I know thatu
is a symbol for first image in sequence anda
one for alpha. But I don't get what the whole expression really does. - What does
info:
stand for? - What does this convert-command exactly do?
Thank you very much for your kind help.
Please note: The accepted answer on the following question has a very good answer to this question:
Understanding ImageMagick's convert and translating to Ruby RMagick