class FormatParser::Image

Constants

NATURE

Attributes

color_mode[RW]

Basic information about the color mode

content_type[RW]

The MIME type of the image file

display_height_px[RW]

Image height when displayed and taking into account things like camera orientation tags and non-square pixels/anamorphicity. The dimensions used for display are always computed by squashing, not by stretching.

If the display width/height are not specified, the sizes of the pixel buffer will get returned instead (values of the `width_px`/`height_px` attributes)

display_width_px[RW]

Image width when displayed and taking into account things like camera orientation tags and non-square pixels/anamorphicity. The dimensions used for display are always computed by squashing, not by stretching.

If the display width/height are not specified, the sizes of the pixel buffer will get returned instead (values of the `width_px`/`height_px` attributes)

format[RW]

What filetype was recognized? Will contain a non-ambiguous symbol referring to the file format. The symbol can be used as a filename extension safely

has_multiple_frames[RW]

Whether the file has multiple frames (relevant for image files and video)

has_transparency[RW]

Whether the image has transparency (or an alpha channel)

height_px[RW]

Number of pixels vertically in the pixel buffer

image_orientation[RW]

Orientation from EXIF data. Will come through as an integer. To be perfectly honest EXIF orientation handling is a bit of a mess, here's a reasonable blog post about it: magnushoff.com/jpeg-orientation.html

intrinsics[RW]

If a parser wants to provide any extra information to the caller it can be placed here

num_animation_or_video_frames[RW]

If the file has animation or is video, this might indicate the number of frames. Some formats do not allow retrieving this value without parsing the entire file, so for GIF this might be nil even though it is animated. For a boolean check, `has_multiple_frames` might offer a better clue.

orientation[RW]

The angle by which the camera was rotated when taking the picture (affects display width and height)

width_px[RW]

Number of pixels horizontally in the pixel buffer

Public Class Methods

new(**attributes) click to toggle source

Only permits assignments via defined accessors

# File lib/image.rb, line 71
def initialize(**attributes)
  attributes.map { |(k, v)| public_send("#{k}=", v) }
  @display_width_px ||= @width_px
  @display_height_px ||= @height_px
end

Public Instance Methods

nature() click to toggle source
# File lib/image.rb, line 77
def nature
  NATURE
end