retouch 0.1.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/retouch.rb CHANGED
@@ -7,8 +7,16 @@ require_relative "retouch/geometry"
7
7
  require_relative "retouch/gravity"
8
8
  require_relative "retouch/operations"
9
9
  require_relative "retouch/pipeline"
10
- require_relative "retouch/cli"
11
10
  require_relative "retouch/io"
11
+ require_relative "retouch/kernels/lut"
12
+ require_relative "retouch/kernels/convolve"
13
+ require_relative "retouch/kernels/color"
14
+ require_relative "retouch/operations/color"
15
+ require_relative "retouch/operations/filter"
16
+ require_relative "retouch/operations/draw"
17
+ require_relative "retouch/operations/multiple"
18
+ require_relative "retouch/batch"
19
+ require_relative "retouch/cli"
12
20
 
13
21
  module Retouch
14
22
  class Error < StandardError; end
@@ -20,4 +28,9 @@ module Retouch
20
28
  def self.from_image(image)
21
29
  Pipeline.new(image)
22
30
  end
31
+
32
+ def self.open_gif(path, frame: :all, **limits)
33
+ result = Operations.open_gif(path, frame:, **limits)
34
+ frame == :all ? result : Pipeline.new(result)
35
+ end
23
36
  end
data/retouch.gemspec CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |spec|
7
7
  spec.version = Retouch::VERSION
8
8
  spec.authors = ["Yudai Takada"]
9
9
  spec.email = ["t.yudai92@gmail.com"]
10
- spec.summary = "Ruby image resizing and shape tools"
11
- spec.description = "A small Ruby image editor and command line tool for resizing and shape operations."
10
+ spec.summary = "Pure Ruby image editing and batch tools"
11
+ spec.description = "A small pure Ruby image editor for color, filter, composite, annotation, and batch operations on PNG, PPM, and BMP images."
12
12
  spec.homepage = "https://github.com/rbgfx/retouch"
13
13
  spec.license = "MIT"
14
14
  spec.required_ruby_version = ">= 3.1.0"
data/sig/retouch.rbs CHANGED
@@ -20,6 +20,33 @@ module Retouch
20
20
  def self.offset: (Integer container_width, Integer container_height, Integer content_width, Integer content_height, Symbol | String gravity) -> [Integer, Integer]
21
21
  end
22
22
 
23
+ module Operations
24
+ def self.info: (untyped image) -> Hash[Symbol, untyped]
25
+ def self.grayscale: (untyped image) -> untyped
26
+ def self.invert: (untyped image) -> untyped
27
+ def self.brightness: (untyped image, Numeric amount) -> untyped
28
+ def self.contrast: (untyped image, Numeric factor) -> untyped
29
+ def self.gamma: (untyped image, Numeric value) -> untyped
30
+ def self.saturate: (untyped image, Numeric factor) -> untyped
31
+ def self.tint: (untyped image, String color, ?amount: Numeric) -> untyped
32
+ def self.opacity: (untyped image, Numeric amount) -> untyped
33
+ def self.quantize: (untyped image, ?colors: Integer, ?dither: Symbol, ?palette: Array[Array[Integer]]?) -> untyped
34
+ def self.blur: (untyped image, Numeric sigma) -> untyped
35
+ def self.sharpen: (untyped image, Numeric sigma, ?amount: Numeric) -> untyped
36
+ def self.pixelate: (untyped image, Integer size) -> untyped
37
+ def self.overlay: (untyped image, untyped source, ?x: Integer?, ?y: Integer?, ?gravity: Symbol | String, ?opacity: Numeric, ?mode: Symbol) -> untyped
38
+ def self.watermark: (untyped image, untyped source, **untyped options) -> untyped
39
+ def self.text: (untyped image, String text, **untyped options) -> untyped
40
+ def self.rect: (untyped image, Integer x, Integer y, Integer width, Integer height, ?String color, ?fill: bool) -> untyped
41
+ def self.arrow: (untyped image, Integer x1, Integer y1, Integer x2, Integer y2, ?String color, ?width: Integer, ?head: Numeric) -> untyped
42
+ def self.append: (Array[untyped] images, ?direction: Symbol, ?gap: Integer, ?background: untyped) -> untyped
43
+ def self.montage: (Array[untyped] images, ?columns: Integer?, ?cols: Integer?, ?gap: Integer, ?background: untyped, ?labels: bool | Array[String]?) -> untyped
44
+ def self.spritesheet: (Array[untyped] images, ?max_width: Integer, ?gap: Integer, ?background: untyped) -> [untyped, Array[Hash[Symbol, Integer]]]
45
+ def self.diff: (untyped expected, untyped actual, ?threshold: Numeric, ?color: String) -> Hash[Symbol, untyped]
46
+ def self.animate: (Array[untyped] frames, String path, ?fps: Numeric?, ?delay: Numeric | Array[Numeric]?, ?loop: bool | Integer, ?colors: Integer, ?palette: Symbol | Array[Array[Integer]], ?dither: Symbol) -> String
47
+ def self.open_gif: (String path, ?frame: Symbol | Integer, ?max_pixels: Integer, ?max_frames: Integer, ?max_total_pixels: Integer) -> untyped
48
+ end
49
+
23
50
  class Pipeline
24
51
  def to_image: -> untyped
25
52
  def info: -> Hash[Symbol, untyped]
@@ -34,10 +61,29 @@ module Retouch
34
61
  def extend: (Integer width, Integer height, **untyped options) -> Pipeline
35
62
  def border: (Integer width, ?String color, **untyped options) -> Pipeline
36
63
  def trim: (**untyped options) -> Pipeline
64
+ def grayscale: -> Pipeline
65
+ def invert: -> Pipeline
66
+ def brightness: (Numeric amount) -> Pipeline
67
+ def contrast: (Numeric factor) -> Pipeline
68
+ def gamma: (Numeric value) -> Pipeline
69
+ def saturate: (Numeric factor) -> Pipeline
70
+ def tint: (String color, **untyped options) -> Pipeline
71
+ def opacity: (Numeric amount) -> Pipeline
72
+ def quantize: (**untyped options) -> Pipeline
73
+ def blur: (Numeric sigma) -> Pipeline
74
+ def sharpen: (Numeric sigma, **untyped options) -> Pipeline
75
+ def pixelate: (Integer size) -> Pipeline
76
+ def overlay: (String | untyped source, **untyped options) -> Pipeline
77
+ def watermark: (String | untyped source, **untyped options) -> Pipeline
78
+ def text: (String text, **untyped options) -> Pipeline
79
+ def rect: (Integer x, Integer y, Integer width, Integer height, ?String color, **untyped options) -> Pipeline
80
+ def arrow: (Integer x1, Integer y1, Integer x2, Integer y2, ?String color, **untyped options) -> Pipeline
37
81
  end
38
82
 
39
83
  def self.open: (String path) -> Pipeline
40
84
  def self.from_image: (untyped image) -> Pipeline
85
+ def self.open_gif: (String path, ?frame: Symbol | Integer, **untyped limits) -> (Array[untyped] | Pipeline)
86
+ def self.batch: (String | Array[String] inputs, to: String, ?jobs: Integer, ?force: bool) { (Pipeline) -> Pipeline } -> Array[String]
41
87
 
42
88
  class CLI
43
89
  def self.run: (Array[String] argv, ?out: untyped, ?err: untyped) -> Integer
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retouch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yudai Takada
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-09-25 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: tessel
@@ -99,8 +100,8 @@ dependencies:
99
100
  - - "~>"
100
101
  - !ruby/object:Gem::Version
101
102
  version: '3.6'
102
- description: A small Ruby image editor and command line tool for resizing and shape
103
- operations.
103
+ description: A small pure Ruby image editor for color, filter, composite, annotation,
104
+ and batch operations on PNG, PPM, and BMP images.
104
105
  email:
105
106
  - t.yudai92@gmail.com
106
107
  executables:
@@ -114,13 +115,22 @@ files:
114
115
  - README.md
115
116
  - Rakefile
116
117
  - bench/retouch.rb
118
+ - docs/index.html
117
119
  - exe/retouch
118
120
  - lib/retouch.rb
121
+ - lib/retouch/batch.rb
119
122
  - lib/retouch/cli.rb
120
123
  - lib/retouch/geometry.rb
121
124
  - lib/retouch/gravity.rb
122
125
  - lib/retouch/io.rb
126
+ - lib/retouch/kernels/color.rb
127
+ - lib/retouch/kernels/convolve.rb
128
+ - lib/retouch/kernels/lut.rb
123
129
  - lib/retouch/operations.rb
130
+ - lib/retouch/operations/color.rb
131
+ - lib/retouch/operations/draw.rb
132
+ - lib/retouch/operations/filter.rb
133
+ - lib/retouch/operations/multiple.rb
124
134
  - lib/retouch/pipeline.rb
125
135
  - lib/retouch/version.rb
126
136
  - retouch.gemspec
@@ -132,6 +142,7 @@ metadata:
132
142
  homepage_uri: https://github.com/rbgfx/retouch
133
143
  source_code_uri: https://github.com/rbgfx/retouch/tree/main
134
144
  rubygems_mfa_required: 'true'
145
+ post_install_message:
135
146
  rdoc_options: []
136
147
  require_paths:
137
148
  - lib
@@ -146,7 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
157
  - !ruby/object:Gem::Version
147
158
  version: '0'
148
159
  requirements: []
149
- rubygems_version: 4.0.16
160
+ rubygems_version: 3.4.19
161
+ signing_key:
150
162
  specification_version: 4
151
- summary: Ruby image resizing and shape tools
163
+ summary: Pure Ruby image editing and batch tools
152
164
  test_files: []