Setting an image color curve for three channels individually?

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
austech360
Posts: 3
Joined: 2019-06-15T02:00:56-07:00
Authentication code: 1152

Setting an image color curve for three channels individually?

Post by austech360 »

I have the following Curve that I would like to apply to an image by using ImageMagick. This curve removes the green by setting the slope of the Green to 0/0. Then the RED and BLUE follow the points,

0,0
254,0
255,255

Image

I was able to get the first part. Removing the green from the image was easy.

Code: Select all

convert Testme.png -channel G -evaluate set 0 +channel test.png
This was SUPER SIMPLE. So thank you devs for that!

However. I am having a seriously rough time getting the last part, which is setting the curve of the last two colors.

I'm sure there is a way to do it because I know that ImageMagick can do literally anything that Photoshop/paint can do. So what is it that I'm missing? I've only ever used ImageMagick for throwing together some mailpieces for my smart home. Again, Thanks devs! I know... Wrong place to give thanks but I am SUPER grateful for such an amazing program that allows such versatile manipulation of images!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Setting an image color curve for three channels individually?

Post by snibgo »

snibgo's IM pages: im.snibgo.com
austech360
Posts: 3
Joined: 2019-06-15T02:00:56-07:00
Authentication code: 1152

Re: Setting an image color curve for three channels individually?

Post by austech360 »

snibgo wrote: 2019-06-15T04:48:30-07:00 How about "-range-threshold" for those channels? See http://www.imagemagick.org/script/comma ... -threshold and https://imagemagick.org/discourse-serve ... =4&t=34604 .
Thanks for the prompt reply!

This seems to only do black and white as far as I can tell. Maybe I don't understand the syntax or how it's supposed to work.

*EDIT*

There is probably more than one way to skin a cat with this. So I'm gonna post what I have vs what I want.

Here's what I have

Image

VS

What I need

Image

Suggestions?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Setting an image color curve for three channels individually?

Post by snibgo »

I would do it like this:

Code: Select all

magick at8XHKF.png -channel RB -threshold 75% -channel G -evaluate set 0 +channel out.png
snibgo's IM pages: im.snibgo.com
austech360
Posts: 3
Joined: 2019-06-15T02:00:56-07:00
Authentication code: 1152

Re: Setting an image color curve for three channels individually?

Post by austech360 »

snibgo wrote: 2019-06-15T09:20:16-07:00 I would do it like this:

Code: Select all

magick at8XHKF.png -channel RB -threshold 75% -channel G -evaluate set 0 +channel out.png
Perfect! All I had to do is change 75 to 99 and I got exactly the result I wanted. THANK YOU SOOOO MUCH! You're a LIFE-SAVER!

Much love!
Post Reply