Opened 9 years ago

Last modified 3 years ago

#18 accepted enhancement

Export colorcycled picture as animated gif

Reported by: pulkomandy Owned by: Thomas Bernard
Priority: major Milestone: 2.9
Component: GrafX2 Version: 2.4
Keywords: Cc:

Description

While we save color cycling information in pictures, most viewers won't know how to use it. There should be a way to export the picture as a plain animated GIF instead.

There is a (tedious) manual process to do this and a python script:
http://www.pixeljoint.com/forum/forum_posts.asp?TID=21619&KW=grafx2

Change History (13)

comment:1 by PulkoMandy, 6 years ago

Milestone: 2.52.6

comment:2 by PulkoMandy, 6 years ago

Owner: changed from Adrien Destugues to PulkoMandy
Status: newassigned

comment:3 by Thomas Bernard, 5 years ago

Owner: changed from PulkoMandy to Thomas Bernard
Status: assignedaccepted

I have though about the good method to do this.

Detect that there is an active color cycle and that we are saving only 1 frame, then ask the user "do you want to save color cycling to animated gif ?"
if yes :
save dummy GIF pictures with "local" color palettes.

it could be a little more difficult if we want to save several color cycle with different speeds and/or different cycle-length

To be able to reload theses gifs correctly, save the CRNG in them, and the GFX2MODE to "COLOR_CYCLING"

comment:4 by PulkoMandy, 5 years ago

I'm not even sure changing the palette in each frame is better supported by the GIF viewers out there (it's supported by the format itself).

I'm undecided if we want this as the normal "save" process or as a separate "export" thing.

comment:5 by Thomas Bernard, 5 years ago

of course it is well supported by the main GIF viewers which are the web browsers.
it is even a trick to make GIF pictures with more than 256 colors. As the limit is 256 per layer you can make a 4096 color GIF with 16 layers ;)

There are a few animated gif out there that change the palette between images. I think I even managed to get my Atari ST Gif viewer to support that ;)

comment:7 by Thomas Bernard, 5 years ago

This GIF : file:///home/nanard/code/git/ngiflib/samples/pjpa11653.gif
has 6 frames, a global palette and frame 2 and 4 have local palettes...

GIF Image descriptor 1 Pos (0,0) 48x48 no local palette 3bpp
GIF Image descriptor 2 Pos (0,0) 48x48 local palette 3bpp
GIF Image descriptor 3 Pos (0,0) 48x48 no local palette 3bpp
GIF Image descriptor 4 Pos (0,0) 48x48 local palette 3bpp
GIF Image descriptor 5 Pos (0,0) 48x48 no local palette 3bpp
GIF Image descriptor 6 Pos (0,0) 48x48 no local palette 3bpp

comment:8 by yrizoud@…, 5 years ago

Browser are well-known for not following the GIF specs. But in the case of multiple palettes, I don't worry too much.

The "file:" url won't work, I assume you mean this one : https://github.com/miniupnp/ngiflib/blob/master/samples/pjpa11653.gif

comment:9 by Thomas Bernard, 5 years ago

huhu sory for the file:/// ;)

Well I guess the reason to export to animated gif is to view in a web browser, so we don't care if they follow 100% the gif spec. They won't anyway as some feature were only relevant to the BBS age ;)

I just though during my dinner that it's not possible to use dummy 1x1 frames as the "old" pixels wont be updated with the new palette. (it is what makes the "true color" GIF possible)
So all pixels that change have to be included in the new frame.
either put them again with always the same index and update the palette each frame, or just put them in each image with the "updated" index. The later may be the more simple to implement and the more efficient as no uncompressed palette has to be stored...

comment:10 by yrizoud@…, 5 years ago

In many images, a lot of colors are not part of any cycle, so a lot of pixel surface stays unchanged for the entirety of the animation. An efficient packing strategy can be to use "Disposal method : Do not dispose", and encode a frame where all unchanged pixels are a solid 'transparent color' : This frame is then a real 'difference' frame, and it hopefully packs well. (Good GIF packers frequently use this strategy)

comment:11 by PulkoMandy, 5 years ago

Milestone: 2.62.7

Move open tickets to 2.7 milestone

comment:12 by PulkoMandy, 4 years ago

Milestone: 2.72.8

comment:13 by PulkoMandy, 3 years ago

Milestone: 2.82.9
Note: See TracTickets for help on using tickets.