mini_vips 0.1.0-x86_64-linux-gnu
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/CHANGELOG.md +23 -0
- data/LICENSE +21 -0
- data/README.md +176 -0
- data/lib/mini_vips/fonts/NotoSans-OFL.txt +93 -0
- data/lib/mini_vips/fonts/NotoSans-Regular.ttf +0 -0
- data/lib/mini_vips/version.rb +5 -0
- data/lib/mini_vips.rb +14 -0
- data/libexec/mini_vips +0 -0
- metadata +52 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c4fa87f586b96d668f60325b73c6afe1a144f2144e5d08527406bd8967cfe9f4
|
|
4
|
+
data.tar.gz: f5a7137830fdbe15bd3615ac9cb73e2f13ec91b9992b08967a0ee9d6b7b55c39
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e5082db7b6ebe0268643af75a60a4bafe254a6c4ec19edf6b691ae8a06e25871b5151b49503060a7e1b125004e1c84bf9c91a58d8209e30a37d12b2934b8df87
|
|
7
|
+
data.tar.gz: cbdcdf8c8f70b38655b04e952093791652c6a4fbb6c3f5564d2ad17fd9d55cdbae6169242f485c3ecb1ee7ab086663adf26b7f00a537d5a5362eb2e3ffa306d6
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-08-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `version` reports the linked libvips version.
|
|
15
|
+
- `letter-avatar` creates a letter avatar with configurable dimensions and background color.
|
|
16
|
+
- `dominant-color` reports a representative RGB color for an image.
|
|
17
|
+
- `resize` supports cover and contain resizing, proportional scaling, maximum pixel limits, output quality, palette limits, and metadata removal.
|
|
18
|
+
- `convert` converts SVG images to PNG within a caller-supplied pixel limit.
|
|
19
|
+
- A bundled Noto Sans font for consistent letter-avatar rendering.
|
|
20
|
+
- Precompiled glibc Linux and macOS gems for x86-64 and ARM64.
|
|
21
|
+
|
|
22
|
+
[Unreleased]: https://github.com/discourse/mini_vips/compare/v0.1.0...HEAD
|
|
23
|
+
[0.1.0]: https://github.com/discourse/mini_vips/releases/tag/v0.1.0
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Discourse
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# mini_vips
|
|
2
|
+
|
|
3
|
+
mini_vips packages the native libvips image operations used by [discourse/discourse](https://github.com/discourse/discourse).
|
|
4
|
+
|
|
5
|
+
mini_vips requires libvips 8.13 or newer to be installed. Follow the [libvips building and installation instructions](https://github.com/libvips/libvips/wiki#building-and-installing) before using it. Precompiled versions of mini_vips are available for glibc Linux and macOS on x86-64 and ARM64.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Add mini_vips to the application's `Gemfile`, then run `bundle install`:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem "mini_vips"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use `MiniVips.executable` to access the CLI executable:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
require "mini_vips"
|
|
19
|
+
|
|
20
|
+
MiniVips.executable
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## CLI
|
|
24
|
+
|
|
25
|
+
### `version`
|
|
26
|
+
|
|
27
|
+
Print the linked libvips version.
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
$ mini_vips version
|
|
31
|
+
8.17.2
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `letter-avatar`
|
|
35
|
+
|
|
36
|
+
Generate a square letter-avatar PNG, 360 by 360 pixels by default.
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
$ mini_vips letter-avatar A avatar.png --background-color C67D28
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
usage:
|
|
44
|
+
letter-avatar letter out [--size pixels] [--letter-size pixels] [--background-color color]
|
|
45
|
+
|
|
46
|
+
where:
|
|
47
|
+
letter - Text displayed in the avatar
|
|
48
|
+
out - Output PNG path
|
|
49
|
+
|
|
50
|
+
options:
|
|
51
|
+
background-color - Six-character RGB background color
|
|
52
|
+
optional, default: 000000
|
|
53
|
+
size - Output width and height in pixels
|
|
54
|
+
optional, default: 360
|
|
55
|
+
min: 1, max: 4096
|
|
56
|
+
letter-size - Letter size in pixels
|
|
57
|
+
optional, default: 7/9 of size
|
|
58
|
+
min: 1, max: 4096
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Letter avatars use the bundled Noto Sans font.
|
|
62
|
+
|
|
63
|
+
### `resize`
|
|
64
|
+
|
|
65
|
+
Resize a supported image and select the output format from the output filename.
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
$ mini_vips resize avatar.png avatar-90.png --width 90 --height 90 --fit cover
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
usage:
|
|
73
|
+
resize in out (--width pixels --height pixels | --scale ratio | --max-pixels pixels)
|
|
74
|
+
[--fit contain|cover] [--position center|top]
|
|
75
|
+
[--without-enlargement] [--quality 1..100]
|
|
76
|
+
[--colors count] [--strip-metadata]
|
|
77
|
+
|
|
78
|
+
where:
|
|
79
|
+
in - Input image path
|
|
80
|
+
out - Output image path
|
|
81
|
+
|
|
82
|
+
options:
|
|
83
|
+
width - Bounding-box or cover width in pixels
|
|
84
|
+
height - Bounding-box or cover height in pixels
|
|
85
|
+
use together, min: 1, max: 65535
|
|
86
|
+
scale - Proportional scale ratio
|
|
87
|
+
min: greater than 0, max: 100
|
|
88
|
+
max-pixels - Maximum output pixel area
|
|
89
|
+
min: 1; never enlarges the image
|
|
90
|
+
fit - Fit within the dimensions or cover them exactly
|
|
91
|
+
optional, default: contain
|
|
92
|
+
position - Crop from the center or top when fit is cover
|
|
93
|
+
optional, default: center
|
|
94
|
+
without-enlargement - Keep an image within the requested dimensions at
|
|
95
|
+
its original size when it is already smaller
|
|
96
|
+
quality - Output encoder quality
|
|
97
|
+
optional, min: 1, max: 100; unavailable for GIF
|
|
98
|
+
colors - Maximum palette size for PNG or GIF output
|
|
99
|
+
optional, min: 2, max: 256; rounded down to the
|
|
100
|
+
nearest palette bit depth supported by the format
|
|
101
|
+
strip-metadata - Remove image metadata from the output
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Supported inputs are JPEG, PNG, GIF, WebP, HEIF, JPEG XL, and SVG. Supported outputs are JPEG, PNG, GIF, WebP, HEIF/AVIF, and JPEG XL. Resize uses the first frame of animated inputs, applies image orientation, preserves transparency when the output format supports it, and sharpens only images produced with `--fit cover`.
|
|
105
|
+
|
|
106
|
+
### `dominant-color`
|
|
107
|
+
|
|
108
|
+
Print a representative color as an uppercase six-character RGB value.
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
$ mini_vips dominant-color image.png
|
|
112
|
+
3A3730
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
usage:
|
|
117
|
+
dominant-color in
|
|
118
|
+
|
|
119
|
+
where:
|
|
120
|
+
in - Input image path
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Supported inputs are JPEG, PNG, GIF, WebP, HEIF, and JPEG XL. Transparent pixels contribute black when calculating the color.
|
|
124
|
+
|
|
125
|
+
### `convert`
|
|
126
|
+
|
|
127
|
+
Convert an SVG into an opaque PNG.
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
$ mini_vips convert image.svg image.png --max-pixels 40000000
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
usage:
|
|
135
|
+
convert in out --max-pixels pixels
|
|
136
|
+
|
|
137
|
+
where:
|
|
138
|
+
in - Input SVG path
|
|
139
|
+
out - Output PNG path
|
|
140
|
+
|
|
141
|
+
options:
|
|
142
|
+
max-pixels - Maximum output pixel area
|
|
143
|
+
required, min: 1
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Currently, `convert` only supports SVG input and PNG output.
|
|
147
|
+
|
|
148
|
+
### Exit status
|
|
149
|
+
|
|
150
|
+
The executable returns:
|
|
151
|
+
|
|
152
|
+
- `0` when the operation succeeds.
|
|
153
|
+
- `1` when image processing fails.
|
|
154
|
+
- `2` when the command or its arguments are invalid.
|
|
155
|
+
|
|
156
|
+
Errors are written to standard error.
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
Install [libvips](https://github.com/libvips/libvips/wiki#building-and-installing) and pkg-config first. Then set up the repository once by installing its Ruby development dependencies:
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
bundle install
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Use the default task during development. It compiles the native helper, runs the tests, and checks Ruby formatting and style:
|
|
167
|
+
|
|
168
|
+
```sh
|
|
169
|
+
bundle exec rake
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Build, install, and test the platform gem with:
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
bundle exec rake test:installed
|
|
176
|
+
```
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2018 The Noto Project Authors (github.com/googlei18n/noto-fonts)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
data/lib/mini_vips.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "mini_vips/version"
|
|
4
|
+
|
|
5
|
+
module MiniVips
|
|
6
|
+
EXECUTABLE_PATH = File.expand_path("../libexec/mini_vips", __dir__)
|
|
7
|
+
private_constant :EXECUTABLE_PATH
|
|
8
|
+
|
|
9
|
+
def self.executable
|
|
10
|
+
return EXECUTABLE_PATH if File.file?(EXECUTABLE_PATH) && File.executable?(EXECUTABLE_PATH)
|
|
11
|
+
|
|
12
|
+
raise "mini_vips executable is unavailable at #{EXECUTABLE_PATH}"
|
|
13
|
+
end
|
|
14
|
+
end
|
data/libexec/mini_vips
ADDED
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mini_vips
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: x86_64-linux-gnu
|
|
6
|
+
authors:
|
|
7
|
+
- Discourse
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
email:
|
|
13
|
+
- team@discourse.org
|
|
14
|
+
executables: []
|
|
15
|
+
extensions: []
|
|
16
|
+
extra_rdoc_files: []
|
|
17
|
+
files:
|
|
18
|
+
- CHANGELOG.md
|
|
19
|
+
- LICENSE
|
|
20
|
+
- README.md
|
|
21
|
+
- lib/mini_vips.rb
|
|
22
|
+
- lib/mini_vips/fonts/NotoSans-OFL.txt
|
|
23
|
+
- lib/mini_vips/fonts/NotoSans-Regular.ttf
|
|
24
|
+
- lib/mini_vips/version.rb
|
|
25
|
+
- libexec/mini_vips
|
|
26
|
+
homepage: https://github.com/discourse/mini_vips
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
- OFL-1.1
|
|
30
|
+
metadata:
|
|
31
|
+
bug_tracker_uri: https://github.com/discourse/mini_vips/issues
|
|
32
|
+
changelog_uri: https://github.com/discourse/mini_vips/blob/main/CHANGELOG.md
|
|
33
|
+
rubygems_mfa_required: 'true'
|
|
34
|
+
source_code_uri: https://github.com/discourse/mini_vips
|
|
35
|
+
rdoc_options: []
|
|
36
|
+
require_paths:
|
|
37
|
+
- lib
|
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
- - "~>"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: 3.4.0
|
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 3.3.22
|
|
48
|
+
requirements: []
|
|
49
|
+
rubygems_version: 3.6.9
|
|
50
|
+
specification_version: 4
|
|
51
|
+
summary: Fixed-purpose libvips image operations for Discourse
|
|
52
|
+
test_files: []
|