gpt_image2_prompt_tools 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2d598e60ac1a9a0d9d58e8aa9f7eb5340746405deb9953ab0450fc30071f2038
4
+ data.tar.gz: 478748c5039812b879ba7b3fb29c83cc6a7604271a08f8ea20232d377a9faa41
5
+ SHA512:
6
+ metadata.gz: 99cc01a7033c69e96911e79e2801113f1de4e79205e21fa81bab84f0f249d8d81b864dc7be7a3726f90099f4e9bf6aa012da9620bc30f3d57edc76e85315a213
7
+ data.tar.gz: de409d009d0ee2d9fd084a396853f14e325ef9eae4a0a18fa7d3a815fcb1b0f085a0a7e3fc3de6ce8f77ddb16d228c607b767629a51b60693541aa329458268e
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,5 @@
1
+ # gpt_image2_prompt_tools
2
+
3
+ Offline Ruby library and CLI (`gpt-image2-spec`) for validating structured image-generation and typography prompt specifications with resolution (1K/2K/4K), aspect ratio, and batch variation presets. Performs no network calls.
4
+
5
+ Homepage: https://gpt-image2.net/
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "json"
5
+ require "optparse"
6
+ require "gpt_image2_prompt_tools"
7
+
8
+ options = { resolution: "2K", aspect_ratio: "16:9", variations: 1, transparent_png: false }
9
+ OptionParser.new do |opts|
10
+ opts.banner = "Usage: gpt-image2-spec --subject TEXT [options]"
11
+ opts.on("-s", "--subject TEXT") { |v| options[:subject] = v }
12
+ opts.on("--style STYLE") { |v| options[:style] = v }
13
+ opts.on("-t", "--text TEXT") { |v| options[:render_text] = v }
14
+ opts.on("-r", "--resolution RES") { |v| options[:resolution] = v }
15
+ opts.on("-a", "--ratio RATIO") { |v| options[:aspect_ratio] = v }
16
+ opts.on("-n", "--variations N", Integer) { |v| options[:variations] = v }
17
+ opts.on("--transparent") { options[:transparent_png] = true }
18
+ opts.on("-v", "--version") { puts GptImage2PromptTools::VERSION; exit 0 }
19
+ end.parse!
20
+
21
+ puts GptImage2PromptTools::PromptSpec.new(**options).to_json
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/gpt_image2_prompt_tools/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gpt_image2_prompt_tools"
7
+ spec.version = GptImage2PromptTools::VERSION
8
+ spec.authors = ["Andy Wang"]
9
+ spec.summary = "Offline Ruby library and CLI for structured image generation and typography prompts."
10
+ spec.description = "Offline Ruby library and CLI utility that validates structured image-generation specifications including 1K/2K/4K resolution presets, aspect ratios, variation counts, and exact typography quotes into JSON manifests. Performs no network calls."
11
+ spec.homepage = "https://gpt-image2.net/"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = ">= 3.1.0"
14
+
15
+ spec.metadata["homepage_uri"] = "https://gpt-image2.net/"
16
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
+
18
+ spec.files = Dir.glob("{lib,bin,test}/**/*") + %w[LICENSE README.md gpt_image2_prompt_tools.gemspec]
19
+ spec.bindir = "bin"
20
+ spec.executables = ["gpt-image2-spec"]
21
+ spec.require_paths = ["lib"]
22
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GptImage2PromptTools
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "gpt_image2_prompt_tools/version"
5
+
6
+ module GptImage2PromptTools
7
+ class ValidationError < StandardError; end
8
+
9
+ RESOLUTIONS = %w[1K 2K 4K].freeze
10
+ ASPECT_RATIOS = %w[1:1 4:3 16:9 9:16 3:4].freeze
11
+
12
+ class PromptSpec
13
+ attr_reader :subject, :style, :render_text, :resolution, :aspect_ratio, :variations, :transparent_png
14
+
15
+ def initialize(subject:, style: "photorealistic", render_text: nil, resolution: "2K", aspect_ratio: "16:9", variations: 1, transparent_png: false)
16
+ @subject = subject.to_s.strip
17
+ @style = style.to_s.strip
18
+ @render_text = render_text&.to_s&.strip
19
+ @resolution = resolution.to_s.strip
20
+ @aspect_ratio = aspect_ratio.to_s.strip
21
+ @variations = Integer(variations)
22
+ @transparent_png = !!transparent_png
23
+ validate!
24
+ end
25
+
26
+ def validate!
27
+ raise ValidationError, "subject cannot be empty" if @subject.empty?
28
+ raise ValidationError, "invalid resolution: #{@resolution}" unless RESOLUTIONS.include?(@resolution)
29
+ raise ValidationError, "invalid aspect_ratio: #{@aspect_ratio}" unless ASPECT_RATIOS.include?(@aspect_ratio)
30
+ raise ValidationError, "variations must be 1..4" unless (1..4).include?(@variations)
31
+ true
32
+ end
33
+
34
+ def assemble
35
+ clauses = ["#{@subject}, #{@style} style"]
36
+ clauses << "exact text \"#{@render_text}\"" if @render_text && !@render_text.empty?
37
+ clauses << "transparent background" if @transparent_png
38
+ clauses << "#{@resolution} (#{@aspect_ratio})"
39
+ clauses.join(", ")
40
+ end
41
+
42
+ def to_h
43
+ {
44
+ subject: @subject,
45
+ style: @style,
46
+ render_text: @render_text,
47
+ resolution: @resolution,
48
+ aspect_ratio: @aspect_ratio,
49
+ variations: @variations,
50
+ transparent_png: @transparent_png,
51
+ prompt: assemble
52
+ }
53
+ end
54
+
55
+ def to_json(*args)
56
+ JSON.generate(to_h, *args)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../lib/gpt_image2_prompt_tools"
4
+
5
+ spec = GptImage2PromptTools::PromptSpec.new(
6
+ subject: "Minimalist product launch poster",
7
+ render_text: "SUMMER 2026",
8
+ resolution: "4K",
9
+ aspect_ratio: "3:4",
10
+ variations: 2
11
+ )
12
+ raise "assemble mismatch" unless spec.assemble.include?("SUMMER 2026")
13
+ raise "json mismatch" unless JSON.parse(spec.to_json)["variations"] == 2
14
+
15
+ begin
16
+ GptImage2PromptTools::PromptSpec.new(subject: "Test", resolution: "8K")
17
+ raise "expected ValidationError"
18
+ rescue GptImage2PromptTools::ValidationError
19
+ puts "gpt_image2_prompt_tools tests passed"
20
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gpt_image2_prompt_tools
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 CLI utility that validates structured image-generation
14
+ specifications including 1K/2K/4K resolution presets, aspect ratios, variation counts,
15
+ and exact typography quotes into JSON manifests. Performs no network calls.
16
+ email:
17
+ executables:
18
+ - gpt-image2-spec
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - LICENSE
23
+ - README.md
24
+ - bin/gpt-image2-spec
25
+ - gpt_image2_prompt_tools.gemspec
26
+ - lib/gpt_image2_prompt_tools.rb
27
+ - lib/gpt_image2_prompt_tools/version.rb
28
+ - test/prompt_spec_test.rb
29
+ homepage: https://gpt-image2.net/
30
+ licenses:
31
+ - MIT
32
+ metadata:
33
+ homepage_uri: https://gpt-image2.net/
34
+ allowed_push_host: https://rubygems.org
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.0
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubygems_version: 3.5.22
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Offline Ruby library and CLI for structured image generation and typography
54
+ prompts.
55
+ test_files: []