class ActiveStorage::Analyzer::ImageAnalyzer

# => { width: 4104, height: 2736 }
ActiveStorage::Analyzer::ImageAnalyzer::ImageMagick.new(blob).metadata
Example:
If the image contains EXIF data indicating its angle is 90 or 270 degrees, its width and height are swapped for convenience.
This is an abstract base class for image analyzers, which extract width and height from an image blob.

def self.accept?(blob)

def self.accept?(blob)
  blob.image?
end

def metadata

def metadata
  read_image do |image|
    if rotated_image?(image)
      { width: image.height, height: image.width }
    else
      { width: image.width, height: image.height }
    end
  end
end