<div dir="ltr"><div>Hi all,</div><div><br></div><div>I've noticed that in the current implementation of GIFReadWriter, we cannot faithfully reproduce the color black when writing it and reading it back in. Quick note: before I rewrote large parts of the GIF stuff in Pharo a while back, it had the same implementation as Squeak. But both then and now, Pharo does not have the problem that I am describing. This leads me to believe that the problem is actually at some low level that I'm not equipped to understand.</div><div><br></div><div>I'm hoping that the collective wisdom on this list might have some ideas. I'm thinking there's something going on with color mapping and Bitmaps (maybe color depths and conversions as well?) which I don't understand very well. On the other hand, I do have a good understanding of the GIF format since I worked on it. The LZW compression is a real nightmare, and even in my Pharo rewrite I had to keep the LZW encoding portions from the original implementation.<br></div><div><br></div><div>The following code, when done in a workspace, will clearly demonstrate the issue:</div><div>```</div><div>blackForm := Form extent: 100@100.<br>blackForm getCanvas fillColor: Color black.<br><br></div><div>"Write to a bytestream"<br></div><div>out := WriteStream on: ByteArray new.<br>writer := GIFReadWriter on: out.<br>writer nextPutImage: blackForm.<br>writer close.<br></div><div><br></div><div>"Read from the bytestream"<br></div><div>in := ReadStream on: out contents.<br>reader := GIFReadWriter on: in.<br>result := reader nextImage.<br><br>(result colorAt: 50@50) inspect.</div><div>```<br></div><div><br></div><div>The resulting color is not what we expect (Color black). It is (Color r: 0.0 g: 0.0 b: 0.004)</div><div><br></div><div>Any ideas what's going on?<br></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Eric</div></div></div></div></div>