autotrace 0.1.9 → 0.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7272a2b850e301d77b91293d841e67f51ae38f37ca7fe4ba5f1fff695a536f73
4
- data.tar.gz: 0afb61a635355976b6f6ed9277da2f427e9f67b8e73cb572b7b4a3a266e2cd92
3
+ metadata.gz: 2e0b6a0eaa8fa8c033ad3873ffba677970de16dfdc5904f2d276204ce6428476
4
+ data.tar.gz: a713ed754342aa28a31ceb5a29e5bf5c51cd914fa69332d3c780856443f97e46
5
5
  SHA512:
6
- metadata.gz: 3eb0e1ac38c154a616b3abf32e422cc645c4c6510c3aa15936cab379eb7b1517fb1ef991f1a213388a555f11c5748e2dc6834507820e2dcba50d115f4f19ebfb
7
- data.tar.gz: f7a219dbc8d55b7adf142901cc2c3ead7b18155b9484a124250248b8a94c94bc37aeb98ac8557a93fff82d71d1bf6b8de4ed62cdbc6a2a155d386b26131f24e0
6
+ metadata.gz: 16a37032bd30960ada05ccae70e030445aa90f775e518c3f4e872fb5290c465f1f57f9ee8f5e2d5aec7fbbf42857aabc32ff2f9511b9cef34567d409fe5cd1b9
7
+ data.tar.gz: 3e9d431fab7bf37dbf05c321b07773cbb727689269f7aa966f4eee4f8877ba2304488ef7b11bb440cfe0e0423490fa319560202806beb0cb4e04ceb2f8b94109
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Autotrace
4
- VERSION = "0.1.9"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Player
8
- autorequire:
9
- bindir: exe
8
+ bindir: bin
10
9
  cert_chain: []
11
- date: 2025-04-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ffi
@@ -35,22 +34,12 @@ executables: []
35
34
  extensions: []
36
35
  extra_rdoc_files: []
37
36
  files:
38
- - ".rubocop.yml"
39
- - ".ruby-version"
40
37
  - CHANGELOG.md
41
- - CODE_OF_CONDUCT.md
42
38
  - LICENSE.txt
43
39
  - README.md
44
- - Rakefile
45
- - examples/Dockerfile
46
- - examples/README.md
47
- - examples/run.sh
48
- - examples/sample.png
49
- - examples/trace_example.rb
50
40
  - lib/autotrace.rb
51
41
  - lib/autotrace/ffi.rb
52
42
  - lib/autotrace/version.rb
53
- - rubygems_attestation_patch.rb
54
43
  homepage: https://github.com/851-labs/autotrace
55
44
  licenses:
56
45
  - MIT
@@ -58,7 +47,6 @@ metadata:
58
47
  homepage_uri: https://github.com/851-labs/autotrace
59
48
  source_code_uri: https://github.com/851-labs/autotrace
60
49
  changelog_uri: https://github.com/851-labs/autotrace/blob/main/CHANGELOG.md
61
- post_install_message:
62
50
  rdoc_options: []
63
51
  require_paths:
64
52
  - lib
@@ -73,8 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
61
  - !ruby/object:Gem::Version
74
62
  version: '0'
75
63
  requirements: []
76
- rubygems_version: 3.5.23
77
- signing_key:
64
+ rubygems_version: 3.6.7
78
65
  specification_version: 4
79
66
  summary: Ruby bindings for the Autotrace library
80
67
  test_files: []
data/.rubocop.yml DELETED
@@ -1,29 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 3.0
3
-
4
- Style/StringLiterals:
5
- EnforcedStyle: double_quotes
6
-
7
- Style/StringLiteralsInInterpolation:
8
- EnforcedStyle: double_quotes
9
-
10
- Metrics/MethodLength:
11
- Enabled: false
12
-
13
- Metrics/ClassLength:
14
- Enabled: false
15
-
16
- Metrics/ModuleLength:
17
- Enabled: false
18
-
19
- Metrics/CyclomaticComplexity:
20
- Enabled: false
21
-
22
- Metrics/AbcSize:
23
- Enabled: false
24
-
25
- Metrics/ParameterLists:
26
- Enabled: false
27
-
28
- Metrics/PerceivedComplexity:
29
- Enabled: false
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.3.5
data/CODE_OF_CONDUCT.md DELETED
@@ -1,132 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official email address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- [INSERT CONTACT METHOD].
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series of
86
- actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or permanent
93
- ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within the
113
- community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.1, available at
119
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
-
121
- Community Impact Guidelines were inspired by
122
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
-
124
- For answers to common questions about this code of conduct, see the FAQ at
125
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
- [https://www.contributor-covenant.org/translations][translations].
127
-
128
- [homepage]: https://www.contributor-covenant.org
129
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
- [Mozilla CoC]: https://github.com/mozilla/diversity
131
- [FAQ]: https://www.contributor-covenant.org/faq
132
- [translations]: https://www.contributor-covenant.org/translations
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "minitest/test_task"
5
-
6
- Minitest::TestTask.create
7
-
8
- require "rubocop/rake_task"
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[test rubocop]
data/examples/Dockerfile DELETED
@@ -1,93 +0,0 @@
1
- FROM ruby:3.3.5-slim
2
-
3
- # Install dependencies for Autotrace based on official build script
4
- RUN apt-get update && apt-get install -y \
5
- build-essential \
6
- git \
7
- libmagickcore-dev \
8
- autotools-dev \
9
- autopoint \
10
- diffutils \
11
- libtool \
12
- intltool \
13
- libpng-dev \
14
- libexif-dev \
15
- libtiff5-dev \
16
- libjpeg-dev \
17
- libxml2-dev \
18
- libbz2-dev \
19
- libpstoedit-dev \
20
- libfreetype6-dev \
21
- libpstoedit0c2a \
22
- libbz2-1.0 \
23
- libgd3 \
24
- libffi-dev \
25
- pkg-config \
26
- curl \
27
- wget \
28
- && rm -rf /var/lib/apt/lists/*
29
-
30
- # Clone and build Autotrace
31
- WORKDIR /tmp
32
- RUN git clone https://github.com/autotrace/autotrace.git && \
33
- cd autotrace && \
34
- ./autogen.sh && \
35
- ./configure --prefix=/usr && \
36
- make && \
37
- make install && \
38
- ldconfig && \
39
- cd .. && \
40
- rm -rf autotrace
41
-
42
- # Set up working directory for the application
43
- WORKDIR /app
44
-
45
- # Create output directory
46
- RUN mkdir -p /app/output
47
-
48
- # Copy the entire gem source code to the container
49
- COPY . /app/autotrace-gem/
50
-
51
- # Install required dependencies for the gem
52
- RUN gem install ffi -v "~> 1.17.1"
53
-
54
- # Copy the example files to /app
55
- COPY examples/trace_example.rb /app/trace_example.rb
56
- COPY examples/run.sh /app/run.sh
57
-
58
- # Make the run script executable
59
- RUN chmod +x /app/run.sh
60
-
61
- # Set RUBYLIB environment variable to include the autotrace gem lib directory
62
- ENV RUBYLIB="/app/autotrace-gem/lib:${RUBYLIB}"
63
-
64
- # Print information about the available libraries
65
- RUN ldconfig -p | grep "libgobject\\|libglib\\|libMagickCore\\|libpstoedit\\|libpng"
66
-
67
- # Set working directory back to /app
68
- WORKDIR /app
69
-
70
- # Find the locations of the required libraries for debugging
71
- RUN echo "Checking for required libraries:" && \
72
- find /usr/lib -name "libautotrace*" && \
73
- find /usr/local/lib -name "libautotrace*" && \
74
- ldconfig -p | grep autotrace
75
-
76
- # Verify that we can load the autotrace gem with better error handling
77
- RUN ruby -e "begin; \
78
- require 'autotrace'; \
79
- puts 'Autotrace gem loaded successfully!'; \
80
- rescue LoadError => e; \
81
- puts \"LoadError: #{e.message}\"; \
82
- exit 1; \
83
- rescue => e; \
84
- puts \"Error: #{e.class.name} - #{e.message}\"; \
85
- puts e.backtrace; \
86
- exit 1; \
87
- end"
88
-
89
- # Set the entry point to the shell script
90
- ENTRYPOINT ["/app/run.sh"]
91
-
92
- # The sample.png should be mounted from the host
93
- # Example: docker run -v $(pwd)/examples/sample.png:/app/sample.png -v $(pwd)/output:/app/output autotrace-example
data/examples/README.md DELETED
@@ -1,62 +0,0 @@
1
- # Autotrace Examples
2
-
3
- This directory contains examples demonstrating how to use the Autotrace gem.
4
-
5
- ## Contents
6
-
7
- - `Dockerfile` - Docker setup for running Autotrace
8
- - `trace_example.rb` - Example Ruby script showing various tracing options
9
- - `sample.png` - Sample image for the examples
10
-
11
- ## Running with Docker
12
-
13
- The provided Dockerfile sets up a complete environment for running Autotrace.
14
-
15
- ### Build the Docker image
16
-
17
- ```bash
18
- docker build -t autotrace-example -f examples/Dockerfile .
19
- ```
20
-
21
- ### Run the container with the sample image
22
-
23
- ```bash
24
- # Create a directory to store output files
25
- mkdir -p output
26
-
27
- # Run the container with the sample image mounted
28
- docker run -v $(pwd)/examples/sample.png:/app/sample.png -v $(pwd)/output:/app/output autotrace-example
29
- ```
30
-
31
- ### Using your own images
32
-
33
- You can convert your own images by mounting them to the container:
34
-
35
- ```bash
36
- docker run -v /path/to/your/image.png:/app/sample.png -v $(pwd)/output:/app/output autotrace-example
37
- ```
38
-
39
- ## Running the Ruby Example Directly
40
-
41
- If you have Autotrace installed on your system, you can run the example script directly:
42
-
43
- ```bash
44
- cd examples
45
- ruby trace_example.rb
46
- ```
47
-
48
- Make sure you have the `sample.png` file in the same directory as the script.
49
-
50
- ## Output
51
-
52
- The traced vector files will be created in the same directory as the input file, with the appropriate extension:
53
-
54
- - `sample.svg` - SVG vector output
55
- - `sample.eps` - EPS vector output (if you run Example 3)
56
-
57
- ## Additional Resources
58
-
59
- For more information about Autotrace and its options, see:
60
-
61
- - [Autotrace GitHub Repository](https://github.com/autotrace/autotrace)
62
- - [Ruby Gem Documentation](https://github.com/851-labs/autotrace)
data/examples/run.sh DELETED
@@ -1,28 +0,0 @@
1
- #!/bin/bash
2
-
3
- echo "==================================================="
4
- echo "Autotrace - Converting raster images to vector graphics"
5
- echo "==================================================="
6
-
7
- if [ ! -f /app/sample.png ]; then
8
- echo "Error: sample.png not found in /app directory."
9
- echo "Please mount your image to /app/sample.png:"
10
- echo " docker run -v /path/to/your/image.png:/app/sample.png autotrace-example"
11
- exit 1
12
- fi
13
-
14
- echo "Found image: /app/sample.png"
15
- echo "Running trace script..."
16
- echo "==================================================="
17
-
18
- # Run the Ruby example script
19
- ruby /app/trace_example.rb
20
-
21
- # Copy output files to output directory
22
- cp /app/*.svg /app/output/ 2>/dev/null || true
23
- cp /app/*.eps /app/output/ 2>/dev/null || true
24
-
25
- echo "==================================================="
26
- echo "Process complete!"
27
- echo "Output files can be found in the mounted output directory"
28
- echo "==================================================="
data/examples/sample.png DELETED
Binary file
@@ -1,57 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- puts "Ruby Version: #{RUBY_VERSION}"
5
- puts "Load Path: #{$LOAD_PATH.join(":")}"
6
- puts "Current Directory: #{Dir.pwd}"
7
- puts "Files in /app/autotrace-gem/lib: #{Dir.glob("/app/autotrace-gem/lib/**/*")}"
8
-
9
- begin
10
- puts "Attempting to require autotrace..."
11
- require "autotrace"
12
- puts "Successfully loaded autotrace!"
13
- rescue LoadError => e
14
- puts "Error loading autotrace: #{e.message}"
15
- puts "Try loading from direct path..."
16
- require_relative "/app/autotrace-gem/lib/autotrace"
17
- puts "Successfully loaded autotrace from direct path!"
18
- end
19
-
20
- # This example demonstrates how to use the Autotrace gem to convert
21
- # a raster image to a vector format with various options.
22
-
23
- def trace_with_options(input_file, options = {})
24
- puts "Converting #{input_file} with options: #{options.inspect}"
25
-
26
- # Trace the image with the specified options
27
- result = Autotrace.trace_image(
28
- input_file,
29
- **options
30
- )
31
-
32
- puts "Conversion complete! Output file: #{result.path}"
33
-
34
- # Return the result file
35
- result
36
- end
37
-
38
- # Example 1: Simple conversion to SVG
39
- puts "Example 1: Simple conversion to SVG"
40
- trace_with_options("sample.png", output_suffix: "svg")
41
-
42
- # Example 2: Conversion with custom options
43
- puts "\nExample 2: Conversion with custom options"
44
- trace_with_options("sample.png",
45
- output_suffix: "svg",
46
- background_color: "FFFFFF", # White background
47
- error_threshold: 1.0, # Lower error threshold for more detail
48
- despeckle_level: 2, # Remove small artifacts
49
- preserve_width: true, # Preserve line widths
50
- centerline: false, # Don't trace along centerline
51
- noise_removal: 0.95) # Remove noise while preserving detail
52
-
53
- # Example 3: Convert to EPS format
54
- puts "\nExample 3: Convert to EPS format"
55
- trace_with_options("sample.png", output_suffix: "eps")
56
-
57
- puts "\nAll conversions completed successfully!"
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- return if RUBY_ENGINE == "jruby"
4
- return unless defined?(Gem)
5
-
6
- require "rubygems/commands/push_command"
7
-
8
- Gem::Commands::PushCommand.prepend(Module.new do
9
- def send_push_request(name, args)
10
- return super if options[:attestations]&.any? || @host != "https://rubygems.org"
11
-
12
- begin
13
- send_push_request_with_attestation(name, args)
14
- rescue StandardError => e
15
- alert_warning "Failed to push with attestation, retrying without attestation.\n#{e.full_message}"
16
- super
17
- end
18
- end
19
-
20
- def send_push_request_with_attestation(name, args)
21
- attestation = attest!(name)
22
- if options[:attestations]
23
- options[:attestations] << attestation
24
- send_push_request(name, args)
25
- else
26
- rubygems_api_request(*args, scope: get_push_scope) do |request|
27
- request.set_form([
28
- ["gem", Gem.read_binary(name), { filename: name, content_type: "application/octet-stream" }],
29
- ["attestations", "[#{Gem.read_binary(attestation)}]", { content_type: "application/json" }]
30
- ], "multipart/form-data")
31
- request.add_field "Authorization", api_key
32
- end
33
- end
34
- end
35
-
36
- def attest!(name)
37
- require "open3"
38
- bundle = "#{name}.sigstore.json"
39
- env = defined?(Bundler.unbundled_env) ? Bundler.unbundled_env : ENV.to_h
40
- out, st = Open3.capture2e(
41
- env,
42
- Gem.ruby, "-S", "gem", "exec",
43
- "sigstore-cli:0.2.1", "sign", name, "--bundle", bundle,
44
- unsetenv_others: true
45
- )
46
- raise Gem::Exception, "Failed to sign gem:\n\n#{out}" unless st.success?
47
-
48
- bundle
49
- end
50
- end)