class ActiveStorage::Transformers::Transformer
backed by ImageProcessing, a common interface for MiniMagick and ruby-vips
* ActiveStorage::Transformers::ImageProcessingTransformer:
The following concrete subclasses are included in Active Storage:
A Transformer applies a set of transformations to an image.
= Active Storage Transformers Transformer
def initialize(transformations)
def initialize(transformations) @transformations = transformations end
def process(file, format:) # :doc:
All subclasses implement this method.
Returns an open Tempfile containing a transformed image in the given +format+.
def process(file, format:) # :doc: raise NotImplementedError end
def transform(file, format:)
specified +format+. Yields an open Tempfile containing the target image. Closes and unlinks
Applies the transformations to the source image in +file+, producing a target image in the
def transform(file, format:) output = process(file, format: format) begin yield output ensure output.close! end end