Computer Graphics

Moderators: Sephiroth
Number of threads: 1263
Number of posts: 2665

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
GIF Negative? (Solved) Posted by Mr_Dylan1615 on 14 Jun 2009 at 9:49 AM
I am trying to decode a GIF image file format. The GIF file format using LZW can return negative references. If you simply use absolute value on these references you get the "GIF Negative" of the image. The GIF negative is not what I expected. It is not just 255-x to get the back to normal. The best way to describe this is to try adding the color into ms paint (or any other software) and clicking negative with the file format set to GIF. Here is an example.
NORMAL -> Negative
RRR GGG BBB -> RRR GGG BBB
255 000 000 -> 255 204 102
000 255 000 -> 255 204 051
000 000 255 -> 255 153 255
255 255 255 -> 255 153 102
I am trying to convert the "GIF Negative" back to "GIF Normal".
Any ideas of where I could find the answer?

Edit: I found the answer. I will post it here. You can delete this post or save it for future reference.
The way "GIF Negative" works is, after you decode the image but before you reference it, you do this:
if (Current reference)<0
(new reference)=(total references)+(Current reference(should be negative number only!))
Note: Do this after you decode using LZW (if needed).



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.