On 2012-07-19 16:45:12, PLATO wrote:
Show quoted text> Image::Info can report the wrong height for BMP files. For example,
> given the attached file:
>
> perl -e 'use Image::Info "image_info"; use Data::Dumper; print Dumper
> image_info "upside-down.bmp";'
>
> $VAR1 = {
> 'width' => 144,
> 'height' => 4294967064,
> ...
> };
>
> Noticing that the image was not 700 miles long, and that the height
> was suspiciously close to 2**32, I discovered
> that BMPs use a negative value for the height when the data is ordered
> from top-to-bottom (instead of the
> "normal" bottom-to-top). The signed 32-bit ints thus produce the
> shown height.
>
> (Image::Size gives the same answer, but Graphics::Magick gives the
> right height of 232.)
>
> A fix is to add something like this to Image::Info::BMP (line 13):
>
> $header[7] = 2**32 - $header[7] if $header[7] >= 2**31;
Thanks for the report and the fix. I just uploaded 1.32_52 to CPAN.
One question yet: do you have a test image available which can be
included to the Image-Info distribution (which means: it's in the public
domain, and it's small) or do you know what tool can create such an image?
Regards,
Slaven