mini_vips 0.1.0-arm64-darwin

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: 4b90d0cb426b75648a2aee42d51f8ee254cdba83b863ff14ea3ea968999ea23a
4
+ data.tar.gz: d4fa13931e4d1a0a97bd9d3f87d1cc19fda7d564d4849f5afb5b579fb64fec2e
5
+ SHA512:
6
+ metadata.gz: 5967e4acb474006b1a81cba99f1bdc91590de22a3148d26bea639d75f87e6e7908ffe063c0c19e11166bf7a0b254dd523636ca318574af5afd56106a1c0c745a
7
+ data.tar.gz: 05bdb0d3fbab14d77dc6c8a7c6d4eb8731fcdd9390c627598485746d5f8c198276fb78af6e8897f6c46f86250dbadcd9d1e310504a3023209eade201decf3995
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.
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MiniVips
4
+ VERSION = "0.1.0"
5
+ end
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: arm64-darwin
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: []