Image Row Stride Bug?
Posted: Thu May 28, 2009 1:06 pm
Hi
I'm using GdPicture to acquire images from a scanning device. 90% of these images will be monochrome but I seem to be having trouble when converting these monochrome images to other image format datatypes (such as AtalaImage or System.Drawing.Bitmap).
If I scan an image in monochrome and then examine the stride setting using the GetStride() property, the property returns '-320' as a value (negative values for the stride should be impossible). When I attempt to convert this image to other formats (in this particular instance an AtalaImage using the Atalasoft.Image.FromBitmap() method), I get an error from the Atalasoft image framework saying that an 'Unusual or invalid row stride property has been detected'. As the bitmap conversion fails at this point, the program can't display the converted bitmap image.
However if I scan the image as 24-bit colour, 256 color, or grayscale and then use the ChangePixelFormat() method to convert the image to 'Format1bppIndexed', GetStride() returns a value of '320' (notice the stride value is now positive and not negative), and the image datatype conversions take place without any problems.
Could you confirm whether or not this is a bug in GdPicture as I only seem to get the problem when handling GdPicture image objects.
Thanks in advance.
I'm using GdPicture to acquire images from a scanning device. 90% of these images will be monochrome but I seem to be having trouble when converting these monochrome images to other image format datatypes (such as AtalaImage or System.Drawing.Bitmap).
If I scan an image in monochrome and then examine the stride setting using the GetStride() property, the property returns '-320' as a value (negative values for the stride should be impossible). When I attempt to convert this image to other formats (in this particular instance an AtalaImage using the Atalasoft.Image.FromBitmap() method), I get an error from the Atalasoft image framework saying that an 'Unusual or invalid row stride property has been detected'. As the bitmap conversion fails at this point, the program can't display the converted bitmap image.
However if I scan the image as 24-bit colour, 256 color, or grayscale and then use the ChangePixelFormat() method to convert the image to 'Format1bppIndexed', GetStride() returns a value of '320' (notice the stride value is now positive and not negative), and the image datatype conversions take place without any problems.
Could you confirm whether or not this is a bug in GdPicture as I only seem to get the problem when handling GdPicture image objects.
Thanks in advance.