Manual
Manual
User Manual:
Open the PDF directly: View PDF .
Page Count: 2
Power GIF
By Hippo Games
Welcome! Hope you will enjoy working with my asset!
About
PowerGif was created for my pixel art editor Pixel Studio. This asset is a wrapper for Unity over my
library SimpleGif that is available on GifHub. So please do not confuse with PowerGif and SimpleGif as
they both have public Gif class =)
There are 3 levels of usage difficulty:
1. SIMPLE. Simple decode/encode operations. Simple call, simple result. However, Unity may
freeze on large files.
2. ADVANCED. Encoding/decoding with iterators allowing you to display a progress bar.
Recommended for large files.
3. REACTIVE. Parallel encoding/decoding with threads will greatly speed up a performance.
Features
- Decoding GIF
- Encoding GIF
- Encoding/decoding iterators for displaying progress bar
- Parallel encoding/decoding with threads
- Converting True Color images to 8 bits with master palettes
- Displaying GIFs AnimatedImage component
- Downloading GIF from WWW
- Quick GIF preview
- Clean and simple C# code
- Unity 5, 2017, 2018 support
- Any platform (Standalone, Android, iOS, WebGL)
Example Scenes
- ConvertTo8BitsExample
- DecodeExample
- DecodeProgressExample
- DecodeParallelExample
- DownloadExample
- EncodeExample
- EncodeProgressExample
- EncodeParallel
- PerformanceExample
- PreviewExample
Usage
- var gif = Gif.Decode(byte[] bytes); will load GIF from binary
- var gif = new Gif(List frames); will create GIF from image list
- gif.Encode(); will return binary ready to be displayed or written on disk
- gif.Frames contains frame list
- each frame has Texture (Texture2D) and Delay (float)
- gif.ApplyPalette(palette); will apply master palette to convert True Color image to 8 bit image
Advanced usage
- var count = Gif.GetDecodeIteratorSize(bytes); will return DecodeIterator size so you can display
progress bar for large files
- var iterator = Gif.DecodeIterator(bytes); will return iterator so you can display progress bar for
large files
- var count = gif.GetEncodeIteratorSize(); will return EncodeIterator size so you can display
progress bar for large files (it always returns frame count + 2)
- var iterator = gif.EncodeIterator(); will return iterator so you can display progress bar for large
files (first part is first frame, penultimate part is GIF header with global color table, last part is
GIF trailer)
- you can break iterator to get fist GIF-frame for preview
Parallel encoding and decoding
- Please refer to DecodeProgressExample and EncodeProgressExample
Converting True Color to 8 bits
- As GIF format supports only up to 256 different colors per frame, you may need to convert True
Color images to 8 bits
- You can read about RGB arrangements here:
https://en.wikipedia.org/wiki/List_of_software_palettes#RGB_arrangements
- Power GIF does not support adaptive palettes now!
- Power GIF can convert True Color images to the following palettes: 6 level RGB (prefered), 6-7-6
levels RGB, 6-8-5 levels RGB, 8-8-4 levels RGB and Graystyle (256 shades of grey)
- To perform image conversion to 8 bits simply use gif.Encode(MasterPalette palette) and
gif.EncodeIterator(MasterPalette palette)
- For parallel encoding use simpleGif.ApplyPalette(MasterPalette)
- You can also apply master palette to each SimpleGif.GifFrame
Performance notes
- Switch to .NET 4.0 to speed up parallel operations
Support
- https://github.com/hippogamesunity/SimpleGif
- hippogamesunity@gmail.com