Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/taylorfinnell/imagecr

Quickly determine image types and attributes in Crystal
https://github.com/taylorfinnell/imagecr

Last synced: 11 days ago
JSON representation

Quickly determine image types and attributes in Crystal

Awesome Lists containing this project

README

        

# imagecr
[![Build Status](https://travis-ci.org/taylorfinnell/imagecr.svg?branch=master)](https://travis-ci.org/taylorfinnell/imagecr)

Image.cr is a shard to quickly and performantly identify an image type and basic
attributes of the image.

## Installation

Add this to your application's `shard.yml`:

```yaml
dependencies:
imagecr:
github: taylorfinnell/imagecr
```

## Supported Image Types

- TIFF
- GIF
- BMP
- PNG
- PSD

## Usage

```crystal
require "imagecr"
```

Open from a URL.

```
image = Imagecr.open("http://someserver.com/test.png")
image.type # => "png"
image.width # => 100
image.height # => 100
```

Open from a local file.

```
image = Imagecr.open("~/Downloads/test.png")
image.type # => "png"
image.width # => 100
image.height # => 100
```