Hi all,
I'm using GdPicture 9 and try to apply Brightness & Contrast for images.
1. Image is imported from scan and set pixel type as below:
oGdPictureImaging.TwainSetPixelType(TwainPixelType.TWPT_BW);
oGdPictureImaging.TwainSetBitDepth(1);
2. When finisht import image, program allow user can change Brightness & Contrast.
oGdPictureImaging.SetBrightness(ImageID, brightnessValue);
oGdPictureImaging.SetContrast(ImageID, contrastValue);
The result is not good with me.
- Set Contrast = 0, user change brightness = -100 -> image to darkness -> OK
- Set Contrast = 0, user change brightness from 20 ~ 100 -> brightness of image seem not change.
I refer to "GDPicture Document Clean up Demo" sample of GDPicture library and the phenomenon is same.
I try to open this image with Picture Manager of Microsoft Office 2010 (PIM), and do same actions (change brightness 20 ~100) -> the image is bright and change to white.
I think behavior of PIM that is right because user change brightness of image to maximum and image so white.
Please tell me about the difference and how to use function brightness of GDPicture to have a behavior look like PIM?
Thanks.
Problem with brightness of image by using SetBrightness
Re: Problem with brightness of image by using SetBrightness
Hello,
There are different ways to adjust Brightness of an image. As my humble opinion, GdPicture uses the most efficient method.
Basically we scale each color component by a factor based on the provided parameter. In case you will use 100 the scale factor will be 2.
IE:
This means that black "colors" (0, 0, 0) will never change. This is quite logic in a colorimetric point of view.
What you seem to want is to turn black (0, 0, 0) to white (255, 255, 255) for a parameter of 100. As my opinion this is totally illogical, or at least this has nothing to do with a brightness adjustment. This is more Increasing/decreasing each color channel.
To do that you just have to use the AdjustRGB() method of the Imaging class. Here an example:
Let me know if you need more information.
With best regards,
Loïc
There are different ways to adjust Brightness of an image. As my humble opinion, GdPicture uses the most efficient method.
Basically we scale each color component by a factor based on the provided parameter. In case you will use 100 the scale factor will be 2.
IE:
Code: Select all
double scale = (100 + parameter) / 100;
component = clamp(component * scale);
What you seem to want is to turn black (0, 0, 0) to white (255, 255, 255) for a parameter of 100. As my opinion this is totally illogical, or at least this has nothing to do with a brightness adjustment. This is more Increasing/decreasing each color channel.
To do that you just have to use the AdjustRGB() method of the Imaging class. Here an example:
Code: Select all
Dim add As Integer = CInt(parameter * 2.55) 'parameter should be a value from -100 to 100
Imaging1.AdjustRGB(m_CurrentImage, add, add, add)
With best regards,
Loïc
Re: Problem with brightness of image by using SetBrightness
Hi Loïc,
I solved my problem, thanks you for your quickly response and effort!
I solved my problem, thanks you for your quickly response and effort!
Who is online
Users browsing this forum: No registered users and 1 guest