Skip to content

module Athena::ImageSize #

The Athena::ImageSize component, AIS for short, allows creating an AIS::Image from various image formats. The component has no dependencies and is framework agnostic.

The image can be provided as a file path, or an IO, such as the response to an HTTP request. The image is processed byte by byte, so large images can be handled without loading the full image into memory.

Warning

This component is NOT intended to check if a file is a valid image and may return nonsensical values if given a non-image file.

Getting Started#

If using this component within the Athena Framework, it is already installed and required for you. Otherwise, you will first need to add it as a dependency:

dependencies:
  athena-image_size:
    github: athena-framework/image-size
    version: ~> 0.1.0

Then run shards install, being sure to require it via require "athena-image_size".

From here you can use AIS::Image as needed.

Constants#

VERSION = "0.1.1"#

Class methods#

.dpi : Float64#

Represents the DPI (Dots Per Inch) used to calculate dimensions of AIS::Image::Format::SVG images, defaulting to 72.0.

View source

.dpi=(dpi : Float64)#

Represents the DPI (Dots Per Inch) used to calculate dimensions of AIS::Image::Format::SVG images, defaulting to 72.0.

View source