[ 
https://issues.apache.org/jira/browse/IMAGING-162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14302875#comment-14302875
 ] 

Myroslav Golub edited comment on IMAGING-162 at 2/3/15 7:25 AM:
----------------------------------------------------------------

[~mgmechanics], here's the link: http://www.fileformat.info/format/bmp/egff.htm

Following are quotes from the document:

{quote}
Width and Height are the width and height of the image in pixels, respectively. 
If Height is a positive number, then the image is a "bottom-up" bitmap with the 
origin in the lower-left corner. If Height is a negative number, then the image 
is a "top-down" bitmap with the origin in the upper-left corner.
{quote}

{quote}
Scan lines are stored from the bottom up if the value of the Height field in 
the bitmap header is a positive value; they are stored from the top down if the 
Height field value is negative. 
{quote}

Wikipedia states this as well:  
http://en.wikipedia.org/wiki/BMP_file_format#Pixel_array_.28bitmap_data.29

{quote}
Unless BITMAPCOREHEADER is used, uncompressed Windows bitmaps also can be 
stored from the top to bottom, when the Image Height value is negative.
{quote}

Microsoft's own documentation: 
https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376%28v=vs.85%29.aspx
{quote}
If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the 
lower-left corner. If biHeight is negative, the bitmap is a top-down DIB and 
its origin is the upper-left corner.
{quote}


was (Author: mgolub):
[~mgmechanics], here's the link: http://www.fileformat.info/format/bmp/egff.htm

Following are quotes from the document:

{quote}
Width and Height are the width and height of the image in pixels, respectively. 
If Height is a positive number, then the image is a "bottom-up" bitmap with the 
origin in the lower-left corner. If Height is a negative number, then the image 
is a "top-down" bitmap with the origin in the upper-left corner.
{quote}

{quote}
Scan lines are stored from the bottom up if the value of the Height field in 
the bitmap header is a positive value; they are stored from the top down if the 
Height field value is negative. 
{quote}

Wikipedia states this as well:  
http://en.wikipedia.org/wiki/BMP_file_format#Pixel_array_.28bitmap_data.29

{quote}
Unless BITMAPCOREHEADER is used, uncompressed Windows bitmaps also can be 
stored from the top to bottom, when the Image Height value is negative.
{quote}

> BMP files with negative bitmap height are not suported
> ------------------------------------------------------
>
>                 Key: IMAGING-162
>                 URL: https://issues.apache.org/jira/browse/IMAGING-162
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: BMP
>    Affects Versions: 1.0
>            Reporter: Myroslav Golub
>             Fix For: Patch Needed
>
>
> The BMP format allows for negative values of the height field in the header. 
> This means that the image lines are stored top-down, not bottom-up as usual 
> (i. e. the first pixel in the pixel array would be in the top left corner of 
> the image, not in the bottom left as usual). However, when a negative-height 
> bitmap is passed, the BmpImageParser attempts to create an array of negative 
> length, and a NegativeArraySizeException ensues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to