https://github.com/JuliaIO/GIFImages.jl
Provides Gif support in Julia using LibGif
https://github.com/JuliaIO/GIFImages.jl
gif hacktoberfest julia
Last synced: over 1 year ago
JSON representation
Provides Gif support in Julia using LibGif
- Host: GitHub
- URL: https://github.com/JuliaIO/GIFImages.jl
- Owner: JuliaIO
- License: mit
- Created: 2022-05-28T13:59:07.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-02T00:36:40.000Z (about 3 years ago)
- Last Synced: 2025-02-23T16:46:44.388Z (over 1 year ago)
- Topics: gif, hacktoberfest, julia
- Language: Julia
- Homepage: https://ashwani-rathee.github.io/GIFImages.jl/dev/
- Size: 175 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

---
GIFImages.jl provides support for decoding and encoding GIF images by wrapping LibGif. GIF(Graphics Interchange Format) supports up to 8 bits per pixel for each image, allowing a single image to reference its own palette of up to 256 different colors chosen from the 24-bit RGB color space. It also supports animations and allows a separate palette which are known as local colormap of up to 256 colors for each frame. GIF is palette based, is very widely used and is a loseless data compression format.
[](https://ashwani-rathee.github.io/GIFImages.jl) [](https://join.slack.com/t/julialang/shared_invite/zt-1hxxb5ryp-Ts_egJ7FRN2muQ7nkTtCNQ) [](https://opensource.org/licenses/MIT) [](https://pkgs.genieframework.com?packages=GIFImages)
### Installation
If you have not yet installed Julia, please follow the [instructions](https://julialang.org/downloads/platform/) for your operating system.
Stable Version
```julia
# Enter ']' from the REPL to enter Pkg mode.
pkg> add GIFImages.jl
```
Dev Version
```julia
using Pkg
# Enter ']' from the REPL to enter Pkg mode.
pkg> add https://github.com/ashwani-rathee/GIFImages.jl.git
```
### Usage
For decoding purposes, GIFImages.jl currently supports `gif_decode` which
decode the GIF image as colorant matrix. The source data needs to be a filename.
#### Arguments
- `filepath::AbstractString` : Path to the gif file
- `use_localpalette::Bool=false` : While decoding, using this argument use of local colormap or global colormap for a particular slice can be specified. Gif files are palette based and have a global colormap(max `256 colors`) but slices/images in gif can have their own local colormap specific to a particular slice/image. These colormap can be used to decode a image if `use_localpalette` as `true`.
#### Examples
```jl
julia> using GIFImages, Downloads
julia> path = "test/data/fire.gif"
"test/data/fire.gif"
julia> img = gif_decode(path)
60×30×33 Array{RGB{N0f8},3} with eltype RGB{N0f8}
```
---
For encoding, GIFImages.jl provides `gif_encode` which encode the GIF colorant matrix to file.
#### Arguments
- `filepath` : Name of the file to which image is written.
- `img` : 3D GIF colorant matrix which has structure of height* width * numofimages and all the images are present as slices of the 3D matrix
- `colormapnum` : Specifies the number of colors to be used for the global colormap
#### Examples
```jl
julia> using GIFImages, Downloads
julia> path = "test/data/fire.gif"
"test/data/fire.gif"
julia> img = gif_decode(path)
60×30×33 Array{RGB{N0f8},3} with eltype RGB{N0f8}
julia> gif_encode("fire.gif", img)
```
### Contributions and Issues:
If you have questions about GIFImages.jl, feel free to get in touch via Slack or open an issue :hearts: