Module: Retouch

Defined in:
lib/retouch.rb,
lib/retouch/io.rb,
lib/retouch/cli.rb,
lib/retouch/batch.rb,
lib/retouch/gravity.rb,
lib/retouch/version.rb,
lib/retouch/geometry.rb,
lib/retouch/pipeline.rb,
lib/retouch/operations.rb,
lib/retouch/kernels/lut.rb,
lib/retouch/kernels/color.rb,
lib/retouch/operations/draw.rb,
lib/retouch/kernels/convolve.rb,
lib/retouch/operations/color.rb,
lib/retouch/operations/filter.rb,
lib/retouch/operations/multiple.rb,
sig/retouch.rbs

Defined Under Namespace

Modules: Gravity, ImageIO, Kernels, Operations Classes: Batch, CLI, Error, Geometry, Pipeline

Constant Summary collapse

VERSION =

Returns:

  • (String)
"0.3.2"

Class Method Summary collapse

Class Method Details

.batch(inputs, to:, jobs: 1, force: false) {|arg0| ... } ⇒ Array[String]

Parameters:

  • inputs (String, Array[String])
  • to: (String)
  • jobs: (Integer) (defaults to: 1)
  • force: (Boolean) (defaults to: false)

Yields:

Yield Parameters:

Yield Returns:

Returns:

  • (Array[String])

Raises:

  • (ArgumentError)


88
89
90
91
92
93
94
95
96
97
# File 'lib/retouch/batch.rb', line 88

def self.batch(inputs, to:, jobs: 1, force: false, &block)
  raise ArgumentError, "a transformation block is required" unless block

  Batch.run(inputs, to:, jobs:, force:) do |input, output|
    pipeline = block.call(Retouch.open(input))
    raise TypeError, "batch block must return a Retouch::Pipeline" unless pipeline.is_a?(Pipeline)

    pipeline.save(output)
  end
end

.from_image(image) ⇒ Pipeline

Parameters:

  • image (Object)

Returns:



28
29
30
# File 'lib/retouch.rb', line 28

def self.from_image(image)
  Pipeline.new(image)
end

.open(path) ⇒ Pipeline

Parameters:

  • path (String)

Returns:



24
25
26
# File 'lib/retouch.rb', line 24

def self.open(path)
  Pipeline.new(ImageIO.read(path))
end

.open_gif(path, frame: :all, **limits) ⇒ Array[untyped], Pipeline

Parameters:

  • path (String)
  • frame: (Symbol, Integer) (defaults to: :all)
  • limits (Object)

Returns:



32
33
34
35
# File 'lib/retouch.rb', line 32

def self.open_gif(path, frame: :all, **limits)
  result = Operations.open_gif(path, frame:, **limits)
  frame == :all ? result : Pipeline.new(result)
end