Opened 5 years ago

Last modified 3 weeks ago

#18 accepted enhancement

Export colorcycled picture as animated gif

Reported by: pulkomandy Owned by: Thomas Bernard
Priority: major Milestone: 2.8
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 (12)

comment:1 Changed 22 months ago by PulkoMandy

Milestone: 2.52.6

comment:2 Changed 21 months ago by PulkoMandy

Owner: changed from Adrien Destugues to PulkoMandy
Status: newassigned

comment:3 Changed 14 months ago by Thomas Bernard

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 Changed 14 months ago by PulkoMandy

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 Changed 14 months ago by Thomas Bernard

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 Changed 14 months ago by Thomas Bernard

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 Changed 14 months ago by yrizoud@…

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 Changed 14 months ago by Thomas Bernard

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 Changed 14 months ago by yrizoud@…

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 Changed 13 months ago by PulkoMandy

Milestone: 2.62.7

Move open tickets to 2.7 milestone

comment:12 Changed 3 weeks ago by PulkoMandy

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