Welcome Guest! You need to login or register to make posts.



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

Rank: Newbie

Groups: Member
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: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 482

Was thanked: 30 time(s) in 30 post(s)

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:
using (var bitmap = new Bitmap("MyImage.JPG"))
using (var brightness = new Brightness(0.1f))
using (var red = bitmap.Channels[Channel.Red])
    bitmap.Channels[Channel.Red] = red;

And this is with Pipeline API:
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))

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