module ImageOptim::ImageMeta

Getting format of image at path or as data

Public Class Methods

format_for_data(data) click to toggle source
# File lib/image_optim/image_meta.rb, line 13
def self.format_for_data(data)
  is = ImageSize.new(data)
  is.format if is
rescue ImageSize::FormatError => e
  warn "#{e} (detecting format of image data)"
end
format_for_path(path) click to toggle source
# File lib/image_optim/image_meta.rb, line 6
def self.format_for_path(path)
  is = ImageSize.path(path)
  is.format if is
rescue ImageSize::FormatError => e
  warn "#{e} (detecting format of image at #{path})"
end