Giter Club home page Giter Club logo

fastimage's Introduction

Fastimage Build Status Hex Version Hex docs

Description

Fastimage finds the dimensions/size or file type of a remote or local image file given the file path or uri respectively. It streams the smallest amount of data necessary to ascertain the file size. This aspect is useful when getting the file size for very large images.

Features

  • Supports bmp, jpeg, png and gif files
  • Supports remote files by using the uri of the image
  • Follows up to three redirects for a given uri
  • Supports local files by using the file path of the image
  • Yields the file size as a map %{width: _w, height: _h}
  • Yields the file type as a string "bmp", "jpeg", "gif" or "png"

Examples

Fastimage.type("https://raw.githubusercontent.com/stephenmoloney/fastimage/master/priv/test.jpg")
# => "jpeg"
Fastimage.size("https://raw.githubusercontent.com/stephenmoloney/fastimage/master/priv/test.jpg")
# => %{height: 142, width: 283}

Installation

Add fastimage to your list of dependencies in mix.exs:

def deps do
  [{:fastimage, "~> 0.0.6"}]
end

Ensure fastimage is started before your application:

def application do
  [applications: [:fastimage]]
end

Tests

mix test

Credit/Acknowledgements

Licence

MIT Licence

fastimage's People

Contributors

eirenauts-infra avatar jonzlin95 avatar kagux avatar stephenmoloney avatar

Watchers

 avatar  avatar

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.