ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - tchoutri/Eikon: Eikōn is an Elixir library providing a read-only interface for image files.
Eikōn is an Elixir library providing a read-only interface for image files. - tchoutri/Eikon
Visit Site

GitHub - tchoutri/Eikon: Eikōn is an Elixir library providing a read-only interface for image files.

GitHub - tchoutri/Eikon: Eikōn is an Elixir library providing a read-only interface for image files.

Eikōn Elixir License Hex Version

Eikōn is an image file parser. Feed it a PNG, JPG, and it will return informations about it.

Table of Contents

  1. Installation
  2. Usage
  3. Examples

Installation

def deps do
    [{:eikon, "~> 0.0.2"}]
end

Usage

Each file format is supported through a parser, for instance Eikon.PNG.Parser which contains the functions to work with it.
For the moment, the following formats are supported :

  • PNG
  • GIF (Although content/1 could be improved)
  • JPEG

The Parser Behaviour

Every parser implements the Parser behaviour, which contains standard functions:

  • General Parsing

    • parse/1
    • parse!/1
  • Magic number checking

    • magic?/1
  • Metadata extraction

    • infos/1
  • Returning the content of the image (without the metadata)

    • content/1
    • content!/1

Examples

Parsing a binary

Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.2.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> alias Eikon.PNG.Parser
nil
iex(2)⋅❯ File.read!("priv/mandelbrot.png") |> Parser.parse
{:ok,
 %Eikon.PNG{bit_depth: 8,
  chunks: {:ok,
   <<0, 0, 0, 3, 115, 66, 73, 84, 8, 8, 8, 219, 225, 79, 224, 0, 0, 32, 0, 73, 68, 65, 84, 120, 94, 237, 217, 235, 113, 228, 56, 150, 6, 208, 204, 117, 137, 52, 65, 46, 148, 13, 116, 161, 77, 40, ...>>},
  color_type: 2, compression: 0, filter: 0, height: 747, interlace: 0,
  width: 1365}}

Only return the metadata

iex(3)⋅❯ File.read!("priv/mandelbrot.png") |> Parser.infos
%Eikon.PNG{bit_depth: 8, chunks: nil, color_type: 2, compression: 0, filter: 0, height: 747, interlace: 0, width: 1365}

Extract some particular metadata

iex(4)⋅❯ image = (File.read!("priv/mandelbrot.png") |> Parser.infos)
%Eikon.PNG{bit_depth: 8, chunks: nil, color_type: 2, compression: 0, filter: 0,
 height: 747, interlace: 0, width: 1365}
iex(5)⋅❯ image.width
1365

Works also with GIFs

iex(6)⋅❯ alias Eikon.GIF.Parser
nil
iex(7)⋅❯ File.read!("priv/hammer_time.gif") |> Parser.infos
%Eikon.GIF{height: 540, images: nil, version: "89a", width: 960}

When you just want to know if it's a valid file.

iex(8)⋅❯ File.read!("priv/hammer_time.gif") |> Parser.magic?
true

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory