Colorize a greyscale thumbnail to be orange

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
clownfish

Colorize a greyscale thumbnail to be orange

Post by clownfish »

I tried Google and the forum search, but found no solution for this particular challenge:
How to transform a picture's thumbnail like this: http://weilguny.net/im/thumbnail.png
into a thumbnail like this: http://weilguny.net/im/thumbnail_over.png
The last one is used if the mouse hovers over the standard thumbnail.

My photographer created this effect using Duplex-Mode in Photoshop. In PHP I realized it by adding 137 to the green channel and 55 to the blue channel - and red being (red+green+blue)/3.
As I don't want to use the PHP image-function for a picture-gallery-manager anymore, I need the Imagemagick commands for this transformation.

Thanks for your advices and hints!
Cheers, Clownfish
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Colorize a greyscale thumbnail to be orange

Post by fmw42 »

Your formula makes no sense. How can red = (red + green + blue)/3.

However, taking your green and blue values and doing a little trial and error with the red value, I get close with:

convert thumbnail.png \
\( -clone 0 -evaluate add 65% \) \
\( -clone 0 -evaluate add 54% \) \
\( -clone 0 -evaluate add 22% \) \
-delete 0 -combine thumbnail_new.png

You can adjust the % values as you want to tweak further.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Colorize a greyscale thumbnail to be orange

Post by anthony »

This looks like a standard Sepia Tone coloring!
http://imagemagick.org/Usage/color/#sepia_tone
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
clownfish

Re: Colorize a greyscale thumbnail to be orange

Post by clownfish »

thanks for your solutions. sepia toning was one of the first approaches i tried, but i didn't get the needed result.

i got the results with fmw42's solution, thanks a lot!

@fmw42: my thoughts were the same about the formula when i read the PHP code which created the thumbnails until now. it doesn't make sense to calculate red to be "(red+green+blue)/3" of a greyscale picture...but for the project the PHP image functions are history now. all the code which manipulates the pictures now is imagemagick-powered.

thanks again - SOLVED!
Post Reply