svg2img 0.1.0-aarch64-linux → 0.1.1-aarch64-linux
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 +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +78 -0
- data/lib/svg2img/version.rb +5 -0
- data/lib/svg2img.rb +16 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fde16b6aa6a98e494e9d364ed04d9cab772dc393aafd316b0f0dbdfb9517e971
|
4
|
+
data.tar.gz: 43dc5c5940a4b3f0646d967f2f1313525044630dbeadc69641aba03e5a913c34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5ef8a37d23118fabfd2399bbc4f7848efd611b889dfb4e0777afb38b7bfea4cd21728f8c866f8fa77b8357ee9bf8b6e9cef3055b6ae253f58ba25e8df6d2af
|
7
|
+
data.tar.gz: 495f854501f62c5f4539d012a0767c6e6c08eba53098908a75671e7b5c31235ab956053a8027f3f68978a9cd15c6115c9ea0f42ed5df53b7775bdbe4141fbd99
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Orvar Segerström
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# Svg2img
|
2
|
+
|
3
|
+
Convert SVG to image. Uses a bundled native binary, and requires no external dependencies.
|
4
|
+
Supported output formats for now:
|
5
|
+
|
6
|
+
- png
|
7
|
+
- jpg
|
8
|
+
- webp
|
9
|
+
- gif
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add the `svg2img` gem to your Gemfile and run `bundle install`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem "svg2img"
|
17
|
+
```
|
18
|
+
|
19
|
+
Alternatively, you can install the gem manually:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
gem install svg2img
|
23
|
+
```
|
24
|
+
|
25
|
+
### Precompiled gems
|
26
|
+
|
27
|
+
We recommend installing the `svg2img` precompiled gems available for Linux and macOS. Installing a precompiled gem avoids the need to compile from source code, which is generally slower and less reliable.
|
28
|
+
|
29
|
+
When installing the `svg2img` gem for the first time using `bundle install`, Bundler will automatically download the precompiled gem for your current platform. However, you will need to inform Bundler of any additional platforms you plan to use.
|
30
|
+
|
31
|
+
To do this, lock your Bundle to the required platforms you will need from the list of supported platforms below:
|
32
|
+
|
33
|
+
```sh
|
34
|
+
bundle lock --add-platform x86_64-linux # Standard Linux (e.g. Heroku, GitHub Actions, etc.)
|
35
|
+
bundle lock --add-platform x86_64-linux-musl # MUSL Linux deployments (i.e. Alpine Linux)
|
36
|
+
bundle lock --add-platform aarch64-linux # ARM64 Linux deployments (i.e. AWS Graviton2)
|
37
|
+
bundle lock --add-platform x86_64-darwin # Intel MacOS (i.e. pre-M1)
|
38
|
+
bundle lock --add-platform arm64-darwin # Apple Silicon MacOS (i.e. M1)
|
39
|
+
```
|
40
|
+
|
41
|
+
## Usage
|
42
|
+
|
43
|
+
Example usage:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require "svg2img"
|
47
|
+
|
48
|
+
circle_svg = <<~SVG
|
49
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
|
50
|
+
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
51
|
+
</svg>
|
52
|
+
SVG
|
53
|
+
png_path = Svg2Img.process_svg(circle_svg, output_format: :png)
|
54
|
+
# png_path is a path to the generated PNG file
|
55
|
+
|
56
|
+
# Rails example
|
57
|
+
data = Rails.cache.fetch([some, deps]) do
|
58
|
+
png_path = Svg2Img.process_svg(circle_svg, output_format: :png)
|
59
|
+
png_data = File.binread(png_path)
|
60
|
+
File.delete(png_path)
|
61
|
+
png_data
|
62
|
+
end
|
63
|
+
send_data(png_data, type: 'image/png', disposition: 'inline')
|
64
|
+
```
|
65
|
+
|
66
|
+
## Development
|
67
|
+
|
68
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
+
|
70
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/0rvar/svg2img-rb.
|
75
|
+
|
76
|
+
## License
|
77
|
+
|
78
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/svg2img.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "svg2img/version"
|
4
|
+
|
5
|
+
begin
|
6
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
7
|
+
require "svg2img/#{Regexp.last_match(1)}/svg2img"
|
8
|
+
rescue LoadError
|
9
|
+
require 'svg2img/svg2img'
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
module Svg2Img
|
14
|
+
class Error < StandardError; end
|
15
|
+
# Your code goes here...
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svg2img
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: aarch64-linux
|
6
6
|
authors:
|
7
7
|
- Orvar Segerström
|
@@ -17,8 +17,12 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- LICENSE.txt
|
21
|
+
- README.md
|
22
|
+
- lib/svg2img.rb
|
20
23
|
- lib/svg2img/3.2/svg2img.so
|
21
24
|
- lib/svg2img/3.3/svg2img.so
|
25
|
+
- lib/svg2img/version.rb
|
22
26
|
homepage: https://github.com/0rvar/svg2img-rb
|
23
27
|
licenses:
|
24
28
|
- MIT
|