This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
tde  
#1 Posted : Saturday, February 17, 2018 10:07:35 AM(UTC)
tde

Rank: Newbie

Groups: Guest
Joined: 2/16/2018(UTC)
Posts: 2

I am trying to process only single channels of my image. How would you go about that?

Let's say I want to increase the brightness of only the red channel.

Can I do that directly or do I have to split and then combine?

Eugene Kosmin  
#2 Posted : Sunday, February 18, 2018 4:54:55 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Guest
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hi,

Unfortunately, there are no planar pixel formats in GraphicsMill. So, the only way is to split and combine the image.

This is a sample with Bitmaps:

Code:
using (var bitmap = new Bitmap("MyImage.JPG"))
using (var brightness = new Brightness(0.1f))
using (var red = bitmap.Channels[Channel.Red])
{
    red.ApplyTransform(brightness);
    bitmap.Channels[Channel.Red] = red;
    bitmap.Save("output.jpg");
}

And this is with Pipeline API:

Code:
using (var reader = ImageReader.Create("MyImage.jpg"))
using (var splitter = new RgbChannelSplitter())
using (var combiner = new RgbChannelCombiner())
using (var writer = ImageWriter.Create("output.jpg"))
using (var brightness = new Brightness(0.1f))
{
    reader.Receivers.Add(splitter);

    combiner.R = splitter.R + brightness;
    combiner.G = splitter.G;
    combiner.B = splitter.B;

    Pipeline.Run(combiner + writer);
}

Best regards,

Eugene Kosmin

The Aurigma Development Team

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.