I have a simple operation I need to do in a web application - take an image, check each pixel, and replace it with a certain color while preserving transparency (if i开发者_高级运维t's transparent it doesn't change). Doing this through PHP is extremely slow due to the size of the image; is there an imagemagick command that will have the same result? The input image is a 32-bit png created by imagemagick by disassembling the layers of a PSD file.
It turned out to be simple (throwing in a resize to minimize the work):
convert $source {$resize} -alpha set -channel RGB -fill '#{$color}' +opaque none $output
精彩评论