GithubHelp home page GithubHelp logo

juliaio / gifimages.jl Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 1.0 179 KB

Provides Gif support in Julia using LibGif

Home Page: https://ashwani-rathee.github.io/GIFImages.jl/dev/

License: MIT License

Julia 100.00%
gif hacktoberfest julia

gifimages.jl's Introduction

Link


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.

Docs-dev Slack License: MIT Downloads

Installation

If you have not yet installed Julia, please follow the instructions for your operating system.

Stable Version

# Enter ']' from the REPL to enter Pkg mode.
pkg> add GIFImages.jl

Dev Version

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

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

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 ♥️

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.