I am using WIA interface to retrieve scanned images. Scanner returns me file named WIA*.tmp.jpg (for example: WIA6F3.tmp.jpg). This is actually a BMP file. But even when I rename it I still get an error:
identify.exe: Length and filesize do not match `C:\Users\Kahanov.Andrey\Desktop\WIA9773.tmp.jpg' @ error/bmp.c/ReadBMPImage/813.
It would be a big issue (because program actually gives away the image information), but there is no way (at least not through im4java) to tell if it is the critical error or not. ImageMagick Display doesn't display the image either. But standart Windows Viewer (Windows 7), VnView, Microsoft Office 2010, Paint.NET, GIMP and my app display it correctly.
I uploaded it to Box https://app.box.com/s/wqzkob059molrbo57biy
I've seen that issue with previous versions (4, 5) addressed on forum.
Bug in BMP file retrieved from scanner
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Bug in BMP file retrieved from scanner
It is a BMP file, which some programs can read successfully, including convert, eg:
... succeeds, and the x.png looks okay (but very boring).
Code: Select all
convert WIA9773.tmp.jpg x.png
snibgo's IM pages: im.snibgo.com
Re: Bug in BMP file retrieved from scanner
Yes, convert.exe do work with it, but identify.exe does not. I don't see the reason to convert file just to get info about it. Especially if files are large (4000x3000 or larger). That was the main reason why I even used ImageMagick. Eventually I load file into program, but sometimes I need to downscale it first. And for that I need info.
PS Picture is boring, but it's just a proof of a bug.
PS Picture is boring, but it's just a proof of a bug.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Bug in BMP file retrieved from scanner
Identify does work, with or without "-verbose". Eg:
Code: Select all
D:\web\im>%IM%identify WIA9773.tmp.jpg
WIA9773.tmp.jpg BMP 1276x1760 1276x1760+0+0 8-bit sRGB 256c 2.247MB 0.000u 0:00.001
identify.exe: Length and filesize do not match `WIA9773.tmp.jpg' @ error/bmp.c/R
eadBMPImage/814.
snibgo's IM pages: im.snibgo.com
Re: Bug in BMP file retrieved from scanner
But nevertheless it still ends up returning error code after execution. There is no guarantee the error was not critical. If it was in some sort of additional data - that would be fine. But there is a message in the error stream and a error code that the program return... I will rewrite some part of im4java. BUT! imdisplay.exe still does NOT work! And that is definitely a bug.
Re: Bug in BMP file retrieved from scanner
It is a bug in the software that created your BMP. The header of your file reports a different size then the actual file size. More info here: http://en.wikipedia.org/wiki/BMP_file_f ... ile_header. ImageMagick reports it as a error if the header contains a higher size and a warning if it is lower:
The header of your file contains a higher size so it will be reported as an error. I am not sure why there is a difference but maybe magick can explain this?
Code: Select all
if ((MagickSizeType) bmp_info.file_size > GetBlobSize(image))
(void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
"LengthAndFilesizeDoNotMatch","`%s'",image->filename);
else
if ((MagickSizeType) bmp_info.file_size < GetBlobSize(image))
(void) ThrowMagickException(exception,GetMagickModule(),
CorruptImageWarning,"LengthAndFilesizeDoNotMatch","`%s'",
image->filename);