Aurigma.GraphicsMill.Bitmap bmp =
new Aurigma.GraphicsMill.Bitmap("x:/24bppRgb.jpg");
//
// Channel of the 24bppRGB image should be 8bppGray.
// Its dimensions should be equal
// to the dimensions of the bitmap.
//
Aurigma.GraphicsMill.Bitmap channel = new Aurigma.GraphicsMill.Bitmap(
Aurigma.GraphicsMill.RgbColor.Black,
bmp.Width,
bmp.Height,
Aurigma.GraphicsMill.PixelFormat.Format8bppGrayScale);
// ... some channel data processing skipped ...
bmp.Channels[Aurigma.GraphicsMill.ColorChannel.Blue] = channel;
bmp.Save("y:/modifiedBlueChannel.jpg");
Please note, that you cannot change channel inplace via Bitmap.Channels property because it returns copy of the requested data. If your task is to modify existing data you should write something like that:
Aurigma.GraphicsMill.Bitmap bmp =
new Aurigma.GraphicsMill.Bitmap("x:/allformats/24bppRgb.jpg");
Aurigma.GraphicsMill.Bitmap channel =
bmp.Channels[Aurigma.GraphicsMill.ColorChannel.Blue];
// ... some channel data processing skipped ...
bmp.Channels[Aurigma.GraphicsMill.ColorChannel.Blue] = channel;
bmp.Save("y:/modifiedBlueChannel.jpg");
tanks alex... but in this way i can't change a single value of red , gree , blue... see this code:
dim myChannels as ChannelBalance
Private Sub trackbarRed_MouseCaptureChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.MouseCaptureChanged
'if isRGB
myChannels(0)=sender.value/100
ApplyTransform(mychannels)
End sub
Private Sub ApplyTransform(ByVal transform As BitmapTransform)
AddHandler transform.Progress, AddressOf Me.bitmap_Progress
transform.ApplyTransform(bitmapViewerMainView.Bitmap)
RemoveHandler transform.Progress, AddressOf Me.bitmap_Progress
End Sub
if I pass 0.4 to Red channel wen i try to return to original value it don't work WHY?????
Hm... I am afraid I don't understand you ;( Is the problem is that transform doesn't work at all, or you cannot find appropriate values?
Please, could you explain in more detail which transform do you use and what results do you expect (maybe little sample project)? And I'll do my best to assist you with the task.
You can submit case if it will be more convenient for you.
Ohh Alex... i'm very affraid!!!! I attempt to explain better my problem... i need to implement a ColorBalance routine such as photoshop - > image -> balance in a project main.sln of graphic mill .net there are a similar routine bat if i try to set a value to one of RGB chanel it impossible to return at original image because if i set to 0.5 the value of red channel, for example, to retur at original image i must to be set to neegative number this value, consequntly -0.5 must to be a value to clean up image to the original. But don't work
Hot to implement color balance for RGB o CMYK image?
In such case you should always apply transform to the original image, because ChannelBalance transform may cause information loss (for example, you can decrease values of several pixels to black (zero) and there is no way to revert this values back).
So it should be someting like that: user set parameter to -4. You apply transform with this value to original image and show the result. The user is not satisfied, he/she sets another parameter value, let it be -2. You apply transform to the original image again with this new value and show the result to user. After several iterations user will be happy! 😉