[Mono-bugs] [Bug 382577] New: Bitmap class corrupts .jpg image in OS X

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 22 19:23:38 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=382577


           Summary: Bitmap class corrupts .jpg image in OS X
           Product: Mono: Class Libraries
           Version: SVN
          Platform: PowerPC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Drawing.
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jesseanders at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=209743)
 --> (https://bugzilla.novell.com/attachment.cgi?id=209743)
Test image used by example program

Description of Problem:

When loading a .jpg image using the System.Drawing.Bitmap class in OS X, the
image is corrupted. With all the images I've tested, it appears to be the third
column of the image (from the left) that is affected.

Steps to reproduce the problem:

Self-contained example program (requires System.Drawing assembly - the image
'test.jpg' is included with this bug report as an attachment):

------------------------------------------------------

using System;
using System.Drawing;

class Program
{
    public static void Main()
    {
        Bitmap bitmap = new Bitmap("test.jpg");

        for (int j = 0; j < bitmap.Height; ++j) {
            for (int i = 0; i < bitmap.Width; ++i) {
                Console.Write("[ {0:x2} {1:x2} {2:x2} ]",
                    bitmap.GetPixel(i,j).R,
                    bitmap.GetPixel(i,j).G,
                    bitmap.GetPixel(i,j).B
                );
            }
            Console.WriteLine();
        }
    }
}

------------------------------------------------------

Actual Results:

The test image is a 4x4 black and white checkboard pattern. The output of the
above program in OS X is:

[ ff ff ff ][ 00 00 00 ][ ff ff ff ][ 00 00 00 ]
[ 00 00 00 ][ ff ff ff ][ 00 00 ff ][ ff ff ff ]
[ ff ff ff ][ 00 00 00 ][ ff ff ff ][ 00 00 00 ]
[ 00 00 00 ][ ff ff ff ][ 00 00 ff ][ ff ff ff ]

Note the second and fourth entries in the third column (they should be [ 00 00
00 ], but are instead [ 00 00 FF ]).

Expected Results:

The expected output is:

[ ff ff ff ][ 00 00 00 ][ ff ff ff ][ 00 00 00 ] 
[ 00 00 00 ][ ff ff ff ][ 00 00 00 ][ ff ff ff ] 
[ ff ff ff ][ 00 00 00 ][ ff ff ff ][ 00 00 00 ] 
[ 00 00 00 ][ ff ff ff ][ 00 00 00 ][ ff ff ff ]

The correct output is produced when the example program is compiled and run in
Windows using Visual C# Express.

How often does this happen?

The results are consistent (the output is incorrect every time the example
program is run in OS X).

Additional Information:

Unless I'm mistaken, this was tested with the latest version of Tao (I checked
out the code from the SVN repository and built it from scratch).

I apologize in advance if this turns out to be a case of user error...

Thanks for your time,

Jesse


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list