Loading...

Region of black & white pictures

Support for GdTwain ActiveX and GdTwain Pro ActiveX/SDK.

Region of black & white pictures

Postby ctn » Tue May 19, 2009 11:06 am

Dear all

I have the following issue:

If I scan a image and use JPEG compression I get different right edge values, for instance:

- Scan resolution 150, PixelType = RGB (2), Compression = JPEG --> result of right edge: 8.266666666666667
- Scan resolution 150, PixelType = BW (0), Compression = JPEG --> result of right edge: 8.32

Why do I get different right edge values for BW or RGB?

Thank you
Br, ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: Region of black & white pictures

Postby ctn » Tue May 19, 2009 3:50 pm

I have performed more tests:

JPEG
[/b]
Blackwhite (PixelType = BW(0)):
-------------------------------
ScanningPrinting.scanningScanPreview():
byte[230308]{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, ...}
sizePixels=832,1169
sizeInches=8.32,11.69
DPI=(100, 100)
--------------------------------------

Greyscale (PixelType = GRAY (1)):
---------------------------------
ScanningPrinting.scanningScanPreview():
byte[276875]{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, ...}
sizePixels=828,1169
sizeInches=8.28,11.69
DPI=(100, 100)
--------------------------------------

Color (PixelType = RGB (2)):
----------------------------
ScanningPrinting.scanningScanPreview():
byte[255271]{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, ...}
sizePixels=828,1169
sizeInches=8.28,11.69
DPI=(100, 100)
--------------------------------------
JPEG / Color (PixelType = RGB (2)):
ScanningPrinting.scanningScanImage(JPEG):
byte[253341]{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, ...}
sizePixels=828,1169
sizeInches=8.28,11.69
DPI=(100, 100)
--------------------------------------
BMP / Color (PixelType = RGB (2)):
ScanningPrinting.scanningScanImage(BMP):
byte[2903850]{0x42, 0x4d, 0x2a, 0x4f, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x3c, 0x03, ...}
sizePixels=828,1169
sizeInches=8.28001642459313,11.6900231888277
DPI=(99.9998016357422, 99.9998016357422)
--------------------------------------
TIFF / Color (PixelType = RGB (2)):
ScanningPrinting.scanningScanImage(TIFF):
byte[814920]{0x49, 0x49, 0x2a, 0x00, 0x8e, 0x6e, 0x0c, 0x00, 0x80, 0x27, 0x15, 0xaa, 0x54, 0xa2, 0xb5, 0x38, 0x94, 0x46, 0x25, 0x21, ...}
sizePixels=828,1169
sizeInches=8.28,11.69
DPI=(100, 100)
--------------------------------------

As you can see the right edge of the BLACKWHITE (8.32 inches) image is different from Color and Grayscale (8.28 inches).
Could you please investigate?
Thanks, ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: Region of black & white pictures

Postby Loïc » Tue May 19, 2009 6:10 pm

Hi,

I don't understand what is the right edge for you. Could you give tell me what it is ? Also, how you determine it ?


Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Region of black & white pictures

Postby ctn » Wed May 20, 2009 9:47 am

Hi

My understanding of right edge is "Double. Value of the right-most edge of the area to scan measured in inches. Note: ImageWidth = nRight - nLeft."
There was a discussion earlier at http://forums.gdpicture.com/post3814.html?hilit=ctn#p3814.

Code snippet how to get the values:

Code: Select all
   public string setImage(byte[] image)
      {
         MemoryStream ms = new MemoryStream(image, false);

         BitmapImage bi = new BitmapImage();
         bi.BeginInit();
         bi.StreamSource = ms;
         bi.EndInit();

         string result = "";
         result += "  sizePixels=" + TypeUtil.objectToString(new Size(bi.PixelWidth, bi.PixelHeight)) + "\r\n";
         result += "  sizeInches=" + TypeUtil.objectToString(new Size(bi.PixelWidth / bi.DpiX, bi.PixelHeight / bi.DpiY)) + "\r\n";
         result += "  DPI=(" + bi.DpiX + ", " + bi.DpiY + ")\r\n";
         //result += "  Format=" + TypeUtil.objectToString(bi.Format) + "\r\n";

         image1.Source = bi;

         return result;
      }


Thanks, ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: Region of black & white pictures

Postby Loïc » Thu May 21, 2009 7:59 pm

Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdTwain [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest