CropToEdges  Method

Description         This method will detect the edges of a scanned image, rotate the image to a precise position and crop the image to these edges. The input DIB must be monochrome, otherwise the method will return NULL. The most common case is when a white scanned paper is surrounded by a black frame, thus the white page is on a black background. The rare case is when a black scanned paper is surrounded by a white frame, thus the black page is on a white background. For images without a contrast frame, the method does not work.

Syntax                 RetVal = [BIDocImg.]CropToEdge  hDIB Threshold StartX Border
WhitePage bMultiPage

Returns               RetVal                    LONGLONG A monochrome, bottom-up DIB.

Remarks             hDib                       LONGLONG Device indipendent bitmap to crop.

                            Threshold              double             The ratio of black and white pixels in a row or column to detect edges. It must be between 0.0 and 1.0, otherwise the method will return NULL and set the error code to PARAMETERERROR. For most of the images this value can be 0.7.

                            StartX                    Long                The method will start the edge detection from that point from left to right. For multipage images you should set this value to 0 and the method will overwrite it with the new value when processing a page. See the code example.

                            Border                    Integer             The cropping border around the image. A positive value enlarges the image in all directions, a negative value shrinks it in all directions.

                            WhitePage             Boolean           TRUE, if a white page is on a black background. FALSE, if a black page is on a white background.

                            bMultiPage            Boolean           If TRUE, the method assumes that the input DIB is multipage. In this case the method will not rotate the image to a precise position. Multiple images can be only in a horizontal orientation, thus with a vertical orientation only one image is allowed.
If FALSE, the method assumes that the input DIB contains a single page only.

See Also              DeskewDIB Method