CropBlackBands problem

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
borquee
Posts: 4
Joined: Wed Mar 12, 2008 5:58 pm

CropBlackBands problem

Post by borquee » Wed Mar 12, 2008 6:08 pm

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
Attachments
probaP.6.tif
probaP.6.tif (1.16 MiB) Viewed 3946 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: CropBlackBands problem

Post by Loïc » Thu Mar 13, 2008 8:19 am

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

borquee
Posts: 4
Joined: Wed Mar 12, 2008 5:58 pm

Re: CropBlackBands problem

Post by borquee » Thu Mar 13, 2008 1:14 pm

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.

borquee
Posts: 4
Joined: Wed Mar 12, 2008 5:58 pm

Re: CropBlackBands problem

Post by borquee » Thu Mar 13, 2008 2:30 pm

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.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: CropBlackBands problem

Post by Loïc » Sun Mar 16, 2008 7:34 pm

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

borquee
Posts: 4
Joined: Wed Mar 12, 2008 5:58 pm

Re: CropBlackBands problem

Post by borquee » Wed Mar 26, 2008 12:25 pm

Thank you for your answer.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: CropBlackBands problem

Post by Loïc » Wed Mar 26, 2008 3:41 pm

You are welcome !

Best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest