fastimage

Library that finds the dimensions and type of an image fetching as little as needed image-processing fastimage
1.2.1 Latest release released

fastimage.cr

Build Status GitHub release GitHub license

Library that finds the dimensions and type of an image fetching as little as needed.

Documentation

https://jetrockets.github.io/fastimage.cr

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      fastimage:
        github:jetrockets/fastimage.cr
    
  2. Run shards install

Usage

require "fastimage"

.type : String|Nil

Returns image type. Returns nil if image type is not supported.

FastImage.type("https://file-examples.com/wp-content/uploads/2017/10/file_example_PNG_3MB.png")
# => png

.type! : String

Same as #type, but raise exception if anything goes wrong.

.dimensions : Tuple(UInt16?, UInt16?)|Nil

Returns image width and height as a Tuple(UInt16?, UInt16?). Returns nil if image type is not supported.

FastImage.dimensions("https://file-examples.com/wp-content/uploads/2017/10/file_example_PNG_3MB.png")
# => [2200, 1467]

.dimensions! : Tuple(UInt16?, UInt16?)

Same as #dimensions, but raise exception if anything goes wrong.

Feature Progress

  • [ ] Data sources
    • [X] Remote file
      • [X] HTTP/HTTPS
      • [ ] Proxy
      • [ ] HTTP redirects
    • [X] Local file
    • [X] IO
    • [X] Base64
  • [ ] File formats
    • [X] BMP
    • [X] CUR
    • [X] GIF
    • [X] ICO
    • [X] JPEG
      • [X] parse EXIF information for JPEG orientation
    • [X] PNG
    • [X] PSD
    • [ ] SVG
    • [X] TIFF
    • [X] WEBP

Contributing

  1. Fork it (https://github.com/jetrockets/fastimage.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

fastimage:
  github: jetrockets/fastimage.cr
  version: ~> 1.2.1
License MIT
Crystal >= 1.0.0, < 2.0.0

Authors

Dependencies 0

Development Dependencies 3

  • ameba ~> 0.14.0
    {'github' => 'crystal-ameba/ameba', 'version' => '~> 0.14.0'}
  • spectator ~> 0.9.20
    {'gitlab' => 'arctic-fox/spectator', 'version' => '~> 0.9.20'}
  • webmock master
    {'branch' => 'master', 'github' => 'manastech/webmock.cr'}

Dependents 1

Last synced .
search fire star recently