aggiii_ai_image_editor 0.1.0
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.
- checksums.yaml +7 -0
- data/LICENSE +14 -0
- data/README.md +19 -0
- data/aggiii_ai_image_editor.gemspec +22 -0
- data/bin/aggiii-edit-spec +19 -0
- data/lib/aggiii_ai_image_editor/version.rb +5 -0
- data/lib/aggiii_ai_image_editor.rb +65 -0
- data/test/edit_spec_test.rb +19 -0
- metadata +55 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fa2ad2f04a5bc2218f625ba28615daa692a2c8e2b119d266ef22ba361a9f11a9
|
|
4
|
+
data.tar.gz: 8b2507d87203f498639c0377e1b65fe4855c855b4d72e8478cd3c94d27b4c8e1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e0bcadfdef5ab52041d2e4699b32aaa293fd9fbd3382a36706b54d8f130ce7be2fe42e0d3123baee1235aa96e350e2dd4c68421f5b90baad3c5f91d001de7108
|
|
7
|
+
data.tar.gz: 8f9a36910c9c1b70f9a18c28682756bd1aaf87bce17baf84437ac0cd668564ea687daab650b1b136a4b79e110fa67a33a69e18c074bd7ab74e48732488b9f272
|
data/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andy Wang
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
data/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# aggiii_ai_image_editor
|
|
2
|
+
|
|
3
|
+
Offline Ruby library and CLI (`aggiii-edit-spec`) for validating structured natural-language photo-editing task specifications and exporting clean JSON/JSONL batch manifests. It does not make network requests or call any remote API.
|
|
4
|
+
|
|
5
|
+
Homepage: https://aggiii.com/ai-image-editor
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
require "aggiii_ai_image_editor"
|
|
11
|
+
|
|
12
|
+
spec = AggiiiAiImageEditor::EditSpec.new(
|
|
13
|
+
source: "portrait.png",
|
|
14
|
+
action: "replace_background",
|
|
15
|
+
instruction: "Replace cluttered office background with bright minimalist studio",
|
|
16
|
+
aspect_ratio: "1:1"
|
|
17
|
+
)
|
|
18
|
+
puts spec.to_prompt
|
|
19
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/aggiii_ai_image_editor/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "aggiii_ai_image_editor"
|
|
7
|
+
spec.version = AggiiiAiImageEditor::VERSION
|
|
8
|
+
spec.authors = ["Andy Wang"]
|
|
9
|
+
spec.summary = "Offline Ruby helper and CLI for natural-language AI image editing specifications."
|
|
10
|
+
spec.description = "Offline Ruby library and command-line utility that validates structured photo-editing task specifications (background replacement, object removal, lighting adjustments, and aspect ratios) and formats JSON manifests. Performs no network calls."
|
|
11
|
+
spec.homepage = "https://aggiii.com/ai-image-editor"
|
|
12
|
+
spec.license = "MIT"
|
|
13
|
+
spec.required_ruby_version = ">= 3.1.0"
|
|
14
|
+
|
|
15
|
+
spec.metadata["homepage_uri"] = "https://aggiii.com/ai-image-editor"
|
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
17
|
+
|
|
18
|
+
spec.files = Dir.glob("{lib,bin,test}/**/*") + %w[LICENSE README.md aggiii_ai_image_editor.gemspec]
|
|
19
|
+
spec.bindir = "bin"
|
|
20
|
+
spec.executables = ["aggiii-edit-spec"]
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "json"
|
|
5
|
+
require "optparse"
|
|
6
|
+
require "aggiii_ai_image_editor"
|
|
7
|
+
|
|
8
|
+
options = { aspect_ratio: "original" }
|
|
9
|
+
OptionParser.new do |opts|
|
|
10
|
+
opts.banner = "Usage: aggiii-edit-spec --source FILE --action ACTION --instruction TEXT"
|
|
11
|
+
opts.on("-s", "--source FILE") { |v| options[:source] = v }
|
|
12
|
+
opts.on("-a", "--action ACTION") { |v| options[:action] = v }
|
|
13
|
+
opts.on("-i", "--instruction TEXT") { |v| options[:instruction] = v }
|
|
14
|
+
opts.on("-r", "--ratio RATIO") { |v| options[:aspect_ratio] = v }
|
|
15
|
+
opts.on("-v", "--version") { puts AggiiiAiImageEditor::VERSION; exit 0 }
|
|
16
|
+
end.parse!
|
|
17
|
+
|
|
18
|
+
spec = AggiiiAiImageEditor::EditSpec.new(**options)
|
|
19
|
+
puts spec.to_json
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require_relative "aggiii_ai_image_editor/version"
|
|
5
|
+
|
|
6
|
+
module AggiiiAiImageEditor
|
|
7
|
+
class ValidationError < StandardError; end
|
|
8
|
+
|
|
9
|
+
ALLOWED_ACTIONS = %w[
|
|
10
|
+
replace_background
|
|
11
|
+
remove_object
|
|
12
|
+
adjust_lighting
|
|
13
|
+
enhance_portrait
|
|
14
|
+
change_outfit
|
|
15
|
+
style_transfer
|
|
16
|
+
].freeze
|
|
17
|
+
|
|
18
|
+
ALLOWED_RATIOS = %w[original 1:1 4:3 3:4 16:9 9:16].freeze
|
|
19
|
+
|
|
20
|
+
class EditSpec
|
|
21
|
+
attr_reader :source, :action, :instruction, :aspect_ratio, :watermark_free
|
|
22
|
+
|
|
23
|
+
def initialize(source:, action:, instruction:, aspect_ratio: "original", watermark_free: true)
|
|
24
|
+
@source = source.to_s.strip
|
|
25
|
+
@action = action.to_s.strip
|
|
26
|
+
@instruction = instruction.to_s.strip
|
|
27
|
+
@aspect_ratio = aspect_ratio.to_s.strip
|
|
28
|
+
@watermark_free = !!watermark_free
|
|
29
|
+
validate!
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def validate!
|
|
33
|
+
raise ValidationError, "source cannot be empty" if @source.empty?
|
|
34
|
+
unless ALLOWED_ACTIONS.include?(@action)
|
|
35
|
+
raise ValidationError, "unsupported action: #{@action}"
|
|
36
|
+
end
|
|
37
|
+
raise ValidationError, "instruction must be at least 5 characters" if @instruction.length < 5
|
|
38
|
+
unless ALLOWED_RATIOS.include?(@aspect_ratio)
|
|
39
|
+
raise ValidationError, "unsupported aspect_ratio: #{@aspect_ratio}"
|
|
40
|
+
end
|
|
41
|
+
true
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_prompt
|
|
45
|
+
parts = ["[#{@action}]", @instruction]
|
|
46
|
+
parts << "(aspect: #{@aspect_ratio})" unless @aspect_ratio == "original"
|
|
47
|
+
parts.join(" ")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def to_h
|
|
51
|
+
{
|
|
52
|
+
source: @source,
|
|
53
|
+
action: @action,
|
|
54
|
+
instruction: @instruction,
|
|
55
|
+
aspect_ratio: @aspect_ratio,
|
|
56
|
+
watermark_free: @watermark_free,
|
|
57
|
+
prompt: to_prompt
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def to_json(*args)
|
|
62
|
+
JSON.generate(to_h, *args)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../lib/aggiii_ai_image_editor"
|
|
4
|
+
|
|
5
|
+
spec = AggiiiAiImageEditor::EditSpec.new(
|
|
6
|
+
source: "demo.jpg",
|
|
7
|
+
action: "replace_background",
|
|
8
|
+
instruction: "Swap background for clean white studio",
|
|
9
|
+
aspect_ratio: "4:3"
|
|
10
|
+
)
|
|
11
|
+
raise "prompt mismatch" unless spec.to_prompt.include?("replace_background")
|
|
12
|
+
raise "json mismatch" unless JSON.parse(spec.to_json)["aspect_ratio"] == "4:3"
|
|
13
|
+
|
|
14
|
+
begin
|
|
15
|
+
AggiiiAiImageEditor::EditSpec.new(source: "", action: "remove_object", instruction: "remove wire")
|
|
16
|
+
raise "expected ValidationError"
|
|
17
|
+
rescue AggiiiAiImageEditor::ValidationError
|
|
18
|
+
puts "aggiii_ai_image_editor tests passed"
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: aggiii_ai_image_editor
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andy Wang
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-11-20 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Offline Ruby library and command-line utility that validates structured
|
|
14
|
+
photo-editing task specifications (background replacement, object removal, lighting
|
|
15
|
+
adjustments, and aspect ratios) and formats JSON manifests. Performs no network
|
|
16
|
+
calls.
|
|
17
|
+
email:
|
|
18
|
+
executables:
|
|
19
|
+
- aggiii-edit-spec
|
|
20
|
+
extensions: []
|
|
21
|
+
extra_rdoc_files: []
|
|
22
|
+
files:
|
|
23
|
+
- LICENSE
|
|
24
|
+
- README.md
|
|
25
|
+
- aggiii_ai_image_editor.gemspec
|
|
26
|
+
- bin/aggiii-edit-spec
|
|
27
|
+
- lib/aggiii_ai_image_editor.rb
|
|
28
|
+
- lib/aggiii_ai_image_editor/version.rb
|
|
29
|
+
- test/edit_spec_test.rb
|
|
30
|
+
homepage: https://aggiii.com/ai-image-editor
|
|
31
|
+
licenses:
|
|
32
|
+
- MIT
|
|
33
|
+
metadata:
|
|
34
|
+
homepage_uri: https://aggiii.com/ai-image-editor
|
|
35
|
+
allowed_push_host: https://rubygems.org
|
|
36
|
+
post_install_message:
|
|
37
|
+
rdoc_options: []
|
|
38
|
+
require_paths:
|
|
39
|
+
- lib
|
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: 3.1.0
|
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '0'
|
|
50
|
+
requirements: []
|
|
51
|
+
rubygems_version: 3.5.22
|
|
52
|
+
signing_key:
|
|
53
|
+
specification_version: 4
|
|
54
|
+
summary: Offline Ruby helper and CLI for natural-language AI image editing specifications.
|
|
55
|
+
test_files: []
|