{"id":18324702,"url":"https://github.com/tchoutri/eikon","last_synced_at":"2025-04-06T00:31:02.726Z","repository":{"id":57493946,"uuid":"58326966","full_name":"tchoutri/Eikon","owner":"tchoutri","description":"Eikōn is an Elixir library providing a read-only interface for image files.","archived":false,"fork":false,"pushed_at":"2022-01-28T08:09:08.000Z","size":1993,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T11:33:20.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tchoutri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-08T19:09:53.000Z","updated_at":"2023-09-01T10:49:38.000Z","dependencies_parsed_at":"2022-09-16T04:40:24.262Z","dependency_job_id":null,"html_url":"https://github.com/tchoutri/Eikon","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tchoutri%2FEikon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tchoutri%2FEikon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tchoutri%2FEikon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tchoutri%2FEikon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tchoutri","download_url":"https://codeload.github.com/tchoutri/Eikon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419597,"owners_count":20936009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:35:34.351Z","updated_at":"2025-04-06T00:31:00.312Z","avatar_url":"https://github.com/tchoutri.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eikōn [![Elixir](https://cdn.rawgit.com/tchoutri/Eikon/master/elixir.svg)](http://elixir-lang.org) [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/tchoutri/eikon/master/LICENSE) [![Hex Version](http://img.shields.io/hexpm/v/eikon.svg?style=flat-square)](https://hex.pm/packages/eikon)\n\nEikōn is an image file parser. Feed it a PNG, JPG, and it will return informations about it.\n\n# Table of Contents\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Examples](#examples)\n\n\n## Installation\n\n```Elixir\ndef deps do\n    [{:eikon, \"~\u003e 0.0.2\"}]\nend\n```\n\n## Usage\nEach file format is supported through a parser, for instance `Eikon.PNG.Parser` which contains the functions to work with it.  \nFor the moment, the following formats are supported :\n\n- [x] PNG\n- [x] GIF (Although `content/1` could be improved)\n- [ ] JPEG\n\n### The `Parser` Behaviour\n\nEvery parser implements the [Parser](lib/eikon.ex#L11) behaviour, which contains standard functions:\n\n* General Parsing\n    * `parse/1`\n    * `parse!/1`\n\n* Magic number checking\n    * `magic?/1`\n\n* Metadata extraction\n    * `infos/1`\n* Returning the content of the image (without the metadata)\n    * `content/1`\n    * `content!/1`\n\n\n## Examples\n### Parsing a binary\n\n```Elixir\nErlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]\n\nInteractive Elixir (1.2.5) - press Ctrl+C to exit (type h() ENTER for help)\niex(1)\u003e alias Eikon.PNG.Parser\nnil\niex(2)⋅❯ File.read!(\"priv/mandelbrot.png\") |\u003e Parser.parse\n{:ok,\n %Eikon.PNG{bit_depth: 8,\n  chunks: {:ok,\n   \u003c\u003c0, 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, ...\u003e\u003e},\n  color_type: 2, compression: 0, filter: 0, height: 747, interlace: 0,\n  width: 1365}}\n```\n\n### Only return the metadata\n```Elixir\niex(3)⋅❯ File.read!(\"priv/mandelbrot.png\") |\u003e Parser.infos\n%Eikon.PNG{bit_depth: 8, chunks: nil, color_type: 2, compression: 0, filter: 0, height: 747, interlace: 0, width: 1365}\n```\n\n### Extract some particular metadata\n```Elixir\niex(4)⋅❯ image = (File.read!(\"priv/mandelbrot.png\") |\u003e Parser.infos)\n%Eikon.PNG{bit_depth: 8, chunks: nil, color_type: 2, compression: 0, filter: 0,\n height: 747, interlace: 0, width: 1365}\niex(5)⋅❯ image.width\n1365\n```\n\n### Works also with GIFs\n```Elixir\niex(6)⋅❯ alias Eikon.GIF.Parser\nnil\niex(7)⋅❯ File.read!(\"priv/hammer_time.gif\") |\u003e Parser.infos\n%Eikon.GIF{height: 540, images: nil, version: \"89a\", width: 960}\n```\n\n### When you just want to know if it's a valid file.\n```Elixir\niex(8)⋅❯ File.read!(\"priv/hammer_time.gif\") |\u003e Parser.magic?\ntrue\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftchoutri%2Feikon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftchoutri%2Feikon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftchoutri%2Feikon/lists"}