1
votes

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 it'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.

1

1 Answers

1
votes

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