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