dpziir0079 2010-10-15 12:05
浏览 108
已采纳

ImageMagick:这个convert-command在做什么?

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:

  1. What does -format "%[fx:u.a]" exactly do? I know that u is a symbol for first image in sequence and a one for alpha. But I don't get what the whole expression really does.
  2. What does info: stand for?
  3. 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

  • 写回答

1条回答 默认 最新

  • dpub33855 2010-10-15 12:18
    关注

    Seems like it is computing the average opacity. The info format is a dummy image format that will instruct convert to output image information to stdout (: means stdout) in the format %[fx:u.a]. Resizing to 1x1 is probably a way of averaging.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP