README
¶
tcgif
Trueclor Gif Generator
Why?
Just for kicks. I saw a similar demo many years back and was curious how hard it would be to reproduce.
How?
Gifs have a limited pallet of 255 colors, but that limit is per frame. Gifs also use transparency as a naive compression method such that the previous frame can show through. By utilizing this, we can in fact get 16 million colors in a single Gif!
todo
- Less naive backfill. Track if the current backfilled color would be closer than a new one.
Samples
Description | Image |
---|---|
No Backfill, Unsorted tcgif -backfill=false -sort=false orig.jpg |
![]() |
No Backfill, Sorted By Popularity tcgif -backfill=false orig.jpg |
![]() |
Backfilled tcgif orig.jpg |
![]() |
Original | ![]() |
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GIFMaker ¶
type GIFMaker struct {
// contains filtered or unexported fields
}
GIFMaker is a struct used to create a "Truecolor GIF" from an image
func NewGIFMaker ¶
NewGIFMaker creates a new GIFMaker with the specified options
type Option ¶
type Option func(*GIFMaker)
Option is a function passed to NewGIFMaker to modify the behavior of GIFMaker
func WithBackfill ¶
WithBackfill sets whether the GIF will be backfilled preemptively with the closest color in the palette.
func WithFinalDelay ¶
WithFinalDelay sets the delay for the final frame of the GIF in 100ths of a second - default is 300
func WithFrameDelay ¶
WithFrameDelay sets the delay for each frame in the GIF in 100ths of a second excluding the final frame which is determined by WithFinalDelay
func WithFrameLimit ¶
WithFrameLimit sets the maximum number of frames to be included in the GIF
func WithPopularitySort ¶
WithPopularitySort sets whether the total palette is sorted by popularity
Disabling this option will result in the palette being sorted by the order in which the colors were found to the image. This can improve performance but may result in a less visually pleasing GIF