[Mono-winforms-list] Weird issues reading pixels of jpg file on osx

Sebastien Pouliot sebastien at ximian.com
Fri Sep 1 10:08:02 EDT 2006


Thanks Dan,

I've opened bug #79246 for the LockBits issues which, from the unit
tests I added this morning, appears to affect every type of bitmaps.

FYI the problem that affected the (first two lines of) JPEG bitmaps
doesn't happen on any other type of pictures.

On Thu, 2006-08-31 at 09:02 -0700, Dan Shryock wrote:
> Sebastien,
> 
> I just ran the code for reading jpegs on the 1.1.14 build on osx and
> it had different results that those that I am currently getting, but
> they were still not correct.  Hope this helps.
> 
> Dan
> 
> On 1.1.14 it came out as:
> 
> 255
> 255
> 255
> 255
> 77
> 255
> 255
> 75
> 144
> 255
> 75
> 143
> 255
> 73
> 144
> 255
> 74
> 145
> 255
> 74
> 147
> 255
> 74
> 147
> 255
> 75
> 150
> 255
> 74
> 149
> 
> On 8/31/06, Sebastien Pouliot <sebastien at ximian.com> wrote:
> > Hello Dan,
> >
> > [please c.c. the mailing-list in your answers]
> >
> > I found a problem with (most) JPEG files where the first two lines had
> > some bad values. This is fixed in SVN :-)
> >
> > However my (new) unit tests using LockBits are all failing - even for
> > bitmaps. Something else is wrong there :-(
> >
> > Note that I'm still curious to know if this was working on previous Mac
> > OS X releases ;-)
> >
> > On Thu, 2006-08-31 at 08:21 -0700, Dan Shryock wrote:
> > > Hi Sebastien,
> > >
> > > Thanks for looking into this.  I just tried it on a png file instead
> > > of the jpeg, and I am still seeing different results for the pixel
> > > data.
> > >
> > > On windows the first few bytes were as follows:
> > > 196
> > > 144
> > > 73
> > > 195
> > > 143
> > > 72
> > >
> > > while on osx they were:
> > > 255
> > > 144
> > > 73
> > > 255
> > > 255
> > > 72
> > >
> > > So something similar seems to be affecting png reading as well as jpeg reading.
> > >
> > > Dan
> > >
> > > On 8/31/06, Sebastien Pouliot <sebastien at ximian.com> wrote:
> > > > Hello Dan,
> > > >
> > > > It may be unrelated to endian issues (but I still like your answers,
> > > > multiple problems are common ;-) as I also found out differences between
> > > > Mono on Linux i386 and Windows.
> > > >
> > > > It seems, in my test case, that the first two lines of the decoded jpeg
> > > > aren't correct. In the first line all 2nd and 4th bytes are identical,
> > > > while on the second line all 3rd and 4th bytes are identical (on the
> > > > mono side, the 4th byte being correct). All other lines looks correct
> > > > (but needs more investigation).
> > > >
> > > > I'm re-enabling the JpegCodec unit tests (not sure why they were
> > > > commented, the ChangeLog says "fixed") and adding new test cases.
> > > >
> > > > Thanks for noticing this.
> > > >
> > > > On Wed, 2006-08-30 at 20:08 -0400, Sebastien Pouliot wrote:
> > > > > Hello Dan,
> > > > >
> > > > > Did the same code worked on a previous version of Mono ? (if so which
> > > > > version ?) or are you testing this for the first time ?
> > > > >
> > > > > Because I recently fixed many endian issues affecting Mac OS X (and
> > > > > other architectures). It is possible that one of them has broken
> > > > > something else :-(
> > > > >
> > > > > I'll try to build a similar test case using one of the embedded bitmap
> > > > > files we have in the unit tests and see how to bots reacts to it.
> > > > >
> > > > > On Wed, 2006-08-30 at 15:56 -0700, Dan Shryock wrote:
> > > > > > When attempting to read the pixel bytes of a jpg on osx (using the
> > > > > > 1.1.17 build just released) I am getting different results on windows
> > > > > > versus osx.  Does anybody have any ideas why I am getting these
> > > > > > different results?  Any information is very appreciated.
> > > > > >
> > > > > > Dan
> > > > > >
> > > > > >
> > > > > > The code being used is as follows:
> > > > > >
> > > > > > Bitmap bmp = new Bitmap("file.jpg");
> > > > > > BitmapData bmpdata = bmp.LockBits(new Rectangle(0,0,bmp.Width,
> > > > > > bmp.Height),ImageLockMode.ReadOnly,PixelFormat.Format24bppRgb);
> > > > > >
> > > > > > unsafe{
> > > > > >     byte* scandata = (byte*) bmpdata.Scan0;
> > > > > >     for(int i=0; i<30; i++){
> > > > > >             Console.WriteLine(scandata[i]);
> > > > > >     }
> > > > > > }
> > > > > >
> > > > > >
> > > > > > and the results using mono on windows are:
> > > > > > 187
> > > > > > 144
> > > > > > 77
> > > > > > 187
> > > > > > 144
> > > > > > 77
> > > > > > 186
> > > > > > 144
> > > > > > 75
> > > > > > 188
> > > > > > 143
> > > > > > 75
> > > > > > 188
> > > > > > 144
> > > > > > 73
> > > > > > 189
> > > > > > 145
> > > > > > 74
> > > > > > 192
> > > > > > 147
> > > > > > 74
> > > > > > 192
> > > > > > 147
> > > > > > 74
> > > > > > 192
> > > > > > 150
> > > > > > 75
> > > > > > 191
> > > > > > 149
> > > > > > 74
> > > > > >
> > > > > > while the results on osx are:
> > > > > > 255
> > > > > > 255
> > > > > > 255
> > > > > > 255
> > > > > > 255
> > > > > > 77
> > > > > > 255
> > > > > > 255
> > > > > > 255
> > > > > > 255
> > > > > > 77
> > > > > > 255
> > > > > > 255
> > > > > > 255
> > > > > > 144
> > > > > > 75
> > > > > > 255
> > > > > > 143
> > > > > > 75
> > > > > > 255
> > > > > > 255
> > > > > > 73
> > > > > > 255
> > > > > > 188
> > > > > > 255
> > > > > > 255
> > > > > > 188
> > > > > > 144
> > > > > > 255
> > > > > > 189
> > > > > > _______________________________________________
> > > > > > Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> > > > > > http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> > > > --
> > > > Sebastien Pouliot  <sebastien at ximian.com>
> > > > Blog: http://pages.infinit.net/ctech/
> > > >
> > > >
> > --
> > Sebastien Pouliot  <sebastien at ximian.com>
> > Blog: http://pages.infinit.net/ctech/
> >
> >
-- 
Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/



More information about the Mono-winforms-list mailing list