Implementing Disposal method for gif89 format

Implementing Disposal method for gif89 format

Post by Umesh Prab » Sat, 12 Jul 2003 15:24:21



Hi all,

Gif89a format supports multiple frames. The disposal method for each
frame indicates in which way the graphic is to be treated after being
displayed.

As per the gif89a specifications, for disposal method = 2, the area
used by the graphic must be restored to the background color.

Question:
Is it logically correct to create gif images that has the same
background color and transparency color and set the disposal method to
2? What should be done in this scenario?

I created a gif image with two frames. The part of the frames that was
supposed to be transparent was set to black color. The background
color was also set to be black.

Assume that before displaying the image, the complete screen is filled
with white color.

When i draw the first frame, the part of the frame that has black
pixels are not displayed on the screen (since the transparency color
is black). Hence, only the non-transparent area of the image is
visible on the screen. The rest of the screen appears white.
Then, i set the complete image area as black (since black is the
background color). Hence the complete area of the image appears black
on the screen.
Now, when i start drawing the second frame, the transparent area of
the image appears black (since black was already displayed as
background color).

However, if i open this image in some image viewer (i tried it in
IE5.0), the transparent area of the second frame is white in color
(instead of black). Hence the question

Thanks
Umesh Prabhu

 
 
 

1. GIF disposal method

Hi all!

This is a question about the disposal method in animated GIFs, but it
probably applies (partially) to MNGs too. I hope someone has an answer
(Mr Melander?) in spite of the detailed nature.

This is what the spec says about disposal methods:

0 - No disposal specified. The decoder is not required to take any
action.
1 - Do not dispose. The graphic is to be left in place.
2 - Restore to background color. The area used by the graphic must be
restored to the background color.
3 - Restore to previous. The decoder is required to restore the area
overwritten by the graphic with what was there prior to rendering the
graphic.

First, I don't understand the difference, if any, between disposal
method 0 and 1.

Secondly, is it possible that an image with delay=0 is followed by an
image with delay>0? The spec does not seem to forbid this, and it does
indeed seem to be a way to update several smallest possible 'dirty
rectangles' in one single animation time-frame. But, in this case, is it
possible that the disposal methods of these different dirty rectangles
composing one time-frame differ? What is a decoder to do if, say, for
example, the first dirty rectangle is disposal method 1 and the second
overlappes it partially and is disposal method 3? Is the 'previous' in
this case the previous time frame or the previous dirty rectangle? Or
should a decoder only pay attention to the disposal method specified in
the final dirty rectangle with the delay>0?

The spec does not seem to forbid all these situations and therefore I
wish to respond 'correct' too them, though it confuses me, and there are
probably few gifs in real life that actually pose these problems.

I do hope someone can answer this. Thanks very much in advance.

Joris

2. inquiring minds want to know...

3. Volume rendering: Which method should I implement?

4. In-cell checkboxes ?

5. implementing method of OpenGL drawing

6. Toolbox disappeared!

7. howto implement a partial PaintBox.Paint method?

8. 3D-plot with triangle as basis

9. GIF89 format

10. GIF89 format specs.

11. Problem with exporting to GIF89 format

12. Saving to .gif format - gif89 not being picked up

13. easiest video format to program/implement