Page 1 of 1

CropBlackBands problem

Posted: Wed Mar 12, 2008 6:08 pm
by borquee
Hi
I am testing GdTwain (lite version) and I have a problem with CropBlackBands

It just doesnt do anything with the picture (example is attached) I tried changing tresholds (0, 20, 50, 75...)

Before CropBlackBands I did CropBorders (which works nice)

I am working with VB6 and latest OCX from the webiste (well... from three days ago)

Thanks,
B

Re: CropBlackBands problem

Posted: Thu Mar 13, 2008 8:19 am
by Loïc
Hi,

Your image is a true color image. The borders are not realy black, they are greyscale.

The CropBlackBands() & CropWhiteBands() methods are optimized to work with true Black and true White color in 1bpp bitmap.

For non indexed color bitmap, you need to use the CropBorders() method like you did :wink:

Best regards,

Loïc Carrère

Re: CropBlackBands problem

Posted: Thu Mar 13, 2008 1:14 pm
by borquee
Hi,
Thanks for your answer... but what is need for treshold parameter if it works with BW pictures only?

I am scanning with ADF and my scan was originaly greyscale 8bit, I mistakenly saved it as 24 bit.

CropBorders() fixed the problem with white border around image and that was great.. just I have to crop the blacks too ... any othere way (except manual crop)

Thanks,
B.

Re: CropBlackBands problem

Posted: Thu Mar 13, 2008 2:30 pm
by borquee
Hi again

CropBlackBands() works if scanner brightness is set to 0.

If brightness is set to 1 it will not work ... well... range of brightness setup is -1000 to 1000 so that value of 1 one should not realy make any difference since it's 8 bit and brightness of 1 should lift the black for about 1/2000 value (right?) and that's no change

Any ideas?

B.

Re: CropBlackBands problem

Posted: Sun Mar 16, 2008 7:34 pm
by Loïc
HI,

I' ve tried CropBorders() on your uploaded image with perfect result. Maybe you need to call this method two times ??

In fact, CropBlackBands() & CropWhiteBands() methods should be used only on 1 bpp image. These methods are checking only for full white RGB(255, 255, 255) or full Black RGB(0, 0, 0) colors.

Code: Select all

range of brightness setup is -1000 to 1000 so that value of 1 one should not realy make any difference since it's 8 bit and brightness of 1 should lift the black for about 1/2000 value (right?) and that's no change
It is another issue but I can say that:
- For index color bitmap it is not working like that. 8bpp image can handle only 256 different colors. Therefore 1/2000 range can't make any sense.
- For true color image it depend of your acquisition device. you can use the TwainGetCapRangeNumeric() method to cath the supported brightness values:

https://www.gdpicture.com/guides/gdpicture/v4/gdtwainp ... meric.html

Code: Select all

Dim bSuccess As Boolean
Dim nMinValue As Double, nMaxValue As Double, nStepValue As Double

bSuccess = Twain1.TwainGetCapRangeNumeric(ICAP_BRIGHTNESS, nMinValue, nMaxValue, nStepValue)

Best regards,

Loïc

Re: CropBlackBands problem

Posted: Wed Mar 26, 2008 12:25 pm
by borquee
Thank you for your answer.

Re: CropBlackBands problem

Posted: Wed Mar 26, 2008 3:41 pm
by Loïc
You are welcome !

Best regards,

Loïc