oximg 0.10.1-x86_64-linux-gnu → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdf6b1dfad022c4423f4d73c1e670ea196cc125212ef31ebb2dce92fe2a9d0b4
4
- data.tar.gz: 698b0a4da238316640f1bb1399df0bf4663c585566a7176e103978c505f21ed4
3
+ metadata.gz: fa259ac9d876ff51995d84c5826f4fbe4712e144ee6beeea9edf70f87e5009a2
4
+ data.tar.gz: 9f7dbf591353da5f44da2a6268644621e1ac620318cc185ea87ff292d83a27d5
5
5
  SHA512:
6
- metadata.gz: c79092dbc459a8ef6653c9b6bba4301021c1374113edeb5e37fa51fa7f6fe057cb498ca66674fe540fcfca6573af8003ad6031fb9558b628948e3770f90b0ddb
7
- data.tar.gz: 159013464fb4e4fee6ab06ea3d00b0bfaa3675c4bfea6dfdc1fa025f88cadd677436eec9a460766472530eee18db9e9c3182bcc36b36bf9d1d4bcda9c5a13a55
6
+ metadata.gz: 25e1e1c1bced631f32c7d263e7872e7a8c7922404be160f00ad5c4d6fc2a559b7fc61cdbc91863ee9c86d4afd3e7abc2cc774c8bbd23db33a03d0ef3b18b0812
7
+ data.tar.gz: 89a63ed7e8177cb911bbc1600a1707831038705993e39c9751efaa9441200099e3c5773e368b5228a6e90847b7dcaf8623a5138f1810db2f9201d1d5f2938864
data/README.md CHANGED
@@ -22,6 +22,10 @@ Oximg.probe("in.jpg")
22
22
  #=> {content_type: "image/jpeg", format: :jpeg, width: 4000, height: 3000}
23
23
  ```
24
24
 
25
+ A GIF source is read and probed like the others (`format: :gif`), but
26
+ nothing encodes GIF: it leaves as the destination's format, WebP when
27
+ the name does not say, and `:gif` is not a `format:` you can ask for.
28
+
25
29
  ## Resizing
26
30
 
27
31
  ```ruby
data/exe/oximg CHANGED
Binary file
data/lib/oximg/version.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Oximg
4
- # The gem version tracks the oximg release whose URL grammar this
5
- # client speaks — the same convention the npm package uses. A gem-only
6
- # fix therefore waits for the next oximg release rather than shipping
7
- # under a version that names a grammar it does not match.
8
- VERSION = "0.10.1"
4
+ # The gem version is the version of the oximg it bundles — the same
5
+ # convention the npm package uses. A gem-only fix therefore waits for
6
+ # the next oximg release rather than shipping under a version that
7
+ # names a binary it does not carry. `Oximg.version` reports what the
8
+ # resolved executable actually is, which can differ when it comes
9
+ # from PATH.
10
+ VERSION = "0.12.0"
9
11
  end
data/lib/oximg.rb CHANGED
@@ -45,10 +45,25 @@ module Oximg
45
45
  "image/jpeg" => :jpeg,
46
46
  "image/png" => :png,
47
47
  "image/webp" => :webp,
48
- "image/avif" => :avif
48
+ "image/avif" => :avif,
49
+ "image/gif" => :gif
49
50
  }.freeze
50
51
 
51
- PROBE_LINE = /:\s+(\S+)\s+(\d+)x(\d+)\s+\(\d+\s+stored\s+pixels\)\s*\z/
52
+ # The line `oximg probe` prints (src/cli.rs):
53
+ #
54
+ # in.gif: image/gif 120x90 (10800 stored pixels), 3 frames, 1500ms, looping forever
55
+ #
56
+ # The three fields the gem reports are pinned exactly. Everything after
57
+ # the comma — the animation summary, printed for an animated source
58
+ # only — is information the gem does not expose, and is deliberately
59
+ # left unparsed rather than matched: a pattern that stopped at
60
+ # `pixels)` is what broke probe when the CLI added that summary, and a
61
+ # pattern that spelled the summary out would break again on the next
62
+ # field. What is refused is output that is not exactly that one line:
63
+ # a field missing, a continuation without the comma, or anything
64
+ # printed before or after it. stderr is captured separately, so a
65
+ # warning never lands here.
66
+ PROBE_LINE = /\A[^\n]*: (\S+) (\d+)x(\d+) \(\d+ stored pixels\)(?:,[^\n]*)?\n?\z/
52
67
 
53
68
  class << self
54
69
  # Absolute path to the executable in use; raises
@@ -96,15 +111,7 @@ module Oximg
96
111
  # dimensions are the stored ones (an EXIF rotation is not applied).
97
112
  def probe(source)
98
113
  out, = Binary.run("probe", expand(source, "source"))
99
- match = out.match(PROBE_LINE)
100
- raise ProcessingError, "unparsable probe output: #{out.inspect}" unless match
101
-
102
- {
103
- content_type: match[1],
104
- format: CONTENT_TYPE_FORMATS[match[1]],
105
- width: Integer(match[2]),
106
- height: Integer(match[3])
107
- }
114
+ parse_probe(out)
108
115
  end
109
116
 
110
117
  # The argv `resize` would run, minus the executable. Public because
@@ -126,6 +133,22 @@ module Oximg
126
133
 
127
134
  private
128
135
 
136
+ # The hash `probe` builds from the line the CLI printed. Separate
137
+ # from `probe` so the parser can be tested against every line the
138
+ # CLI can print — the still form, each loop spelling — without a
139
+ # binary present; private because nothing outside needs it.
140
+ def parse_probe(output)
141
+ match = output.match(PROBE_LINE)
142
+ raise ProcessingError, "unparsable probe output: #{output.inspect}" unless match
143
+
144
+ {
145
+ content_type: match[1],
146
+ format: CONTENT_TYPE_FORMATS[match[1]],
147
+ width: Integer(match[2]),
148
+ height: Integer(match[3])
149
+ }
150
+ end
151
+
129
152
  # Absolute paths throughout: a relative name beginning with "-"
130
153
  # would otherwise reach the CLI's argument parser as a flag, and
131
154
  # the caller rarely controls what an uploaded file is called.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oximg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.12.0
5
5
  platform: x86_64-linux-gnu
6
6
  authors:
7
7
  - oximg contributors
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-08-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: 'Ruby bindings for oximg, the high-performance Rust image compression
13
13
  and resizing engine: JPEG, PNG, WebP and AVIF, resized in linear light. Platform
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
- rubygems_version: 3.6.2
49
+ rubygems_version: 3.6.9
50
50
  specification_version: 4
51
51
  summary: Image compression and resizing for Ruby, without libvips or ImageMagick
52
52
  test_files: []