himg 0.0.7-x86_64-linux → 0.0.9-x86_64-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/CHANGELOG.md +15 -0
- data/README.md +70 -1
- data/lib/himg/3.2/himg.so +0 -0
- data/lib/himg/3.3/himg.so +0 -0
- data/lib/himg/3.4/himg.so +0 -0
- data/lib/himg/cli.rb +1 -0
- data/lib/himg/version.rb +1 -1
- data/lib/himg.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84e5a750a119fc3c6d273978acf294962bdb6e08ef871c2eab40355416f8c1ca
|
4
|
+
data.tar.gz: bb16a11c4c39b69a8d6f8ebd29fbe2d58e261751220244f8a7e0831ea91e7035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14350b0e1fca9acc21a180e7d15771af7cf08f48258738b8fe8598f5747d3d0ddee1bfc1b5b565d387be847f89a5825cd21b0f6aadb54eae2d7607a06c04afc9
|
7
|
+
data.tar.gz: bbe2fb632e9c7c0b9d31c0966f28690931d129bca69b2bc96e0ed373838128557f346ba1ff01e6d8f38c4b6d2608f33fe9836f5a7d02be2e6e0b72310d31d245
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
|
4
|
+
## [0.0.9] - 2025-07-31
|
5
|
+
|
6
|
+
- Returned to CPU-only rendering by default
|
7
|
+
- Added `gpu` option to enable GPU rendering
|
8
|
+
- Updated to latest blitz to fix blue/green colour swap on images
|
9
|
+
|
10
|
+
## [0.0.8] - 2025-07-31
|
11
|
+
|
12
|
+
- Return to GPU rendering by default: quality is low with CPU rendering.
|
13
|
+
- Compile native Apple darwin/macos gems for intel and arm.
|
14
|
+
- Remove debug symbols saving 315MB on the binary size.
|
15
|
+
|
3
16
|
## [0.0.7] - 2025-07-29
|
4
17
|
|
5
18
|
- Added `fetch_timeout` option to control restrict how long can be spent fetching resources.
|
@@ -7,6 +20,8 @@
|
|
7
20
|
|
8
21
|
## [0.0.6] - 2025-07-23
|
9
22
|
|
23
|
+
- Updates to latest blitz
|
24
|
+
- Renders on CPU instead of GPU (experimental)
|
10
25
|
- Added bin/himg CLI screenshot tool
|
11
26
|
- Added `base_url` option for configuring relative paths
|
12
27
|
- Added `disable_fetch` option for security hardening
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
You give it HTML and it gives back an image!
|
4
4
|
|
5
|
-
Parses
|
5
|
+
Parses HTML/CSS, fetches nested resources, renders an image. No browser, no fuss.
|
6
6
|
|
7
7
|
Perfect for OpenGraph images - stop losing clicks to boring links by adding a rich image preview that showcases your content.
|
8
8
|
|
@@ -13,6 +13,7 @@ Perfect for OpenGraph images - stop losing clicks to boring links by adding a ri
|
|
13
13
|
### Command Line
|
14
14
|
|
15
15
|
```bash
|
16
|
+
gem install himg
|
16
17
|
himg screenshot path/to/your.html screenshot.png
|
17
18
|
himg screenshot https://github.com/Jamedjo/himg himg.png --width=1024 --verbose --no-truncate
|
18
19
|
```
|
@@ -66,6 +67,7 @@ bundle add himg
|
|
66
67
|
|base_url | Where relative paths are relative to for linked resources (stylesheets, images, fonts, etc) | string | nil |
|
67
68
|
|disable_fetch | Disables fetching linked resources from disk and network| bool | false |
|
68
69
|
|fetch_timeout | Timeout in seconds for fetching resources | float | 10.0 |
|
70
|
+
|gpu | Use GPU renderer instead of CPU renderer | bool | false |
|
69
71
|
|
70
72
|
|
71
73
|
### Passing options to a Rails view template
|
@@ -121,6 +123,72 @@ respond_to do |format|
|
|
121
123
|
end
|
122
124
|
```
|
123
125
|
|
126
|
+
# Supported HTML and CSS
|
127
|
+
|
128
|
+
Himg supports a large subset of the HTML and CSS you'd need to get by, but not all elements or properties are supported.
|
129
|
+
|
130
|
+
For a full list, see our [snapshot of the blitz.is status page](https://github.com/Jamedjo/himg/issues/2).
|
131
|
+
|
132
|
+
If something you'd like supported is missing and is available [upstream on blitz](https://blitz.is/status), please [open an issue](https://github.com/Jamedjo/himg/issues/new).
|
133
|
+
|
134
|
+
|HTML|Status|
|
135
|
+
|-|-|
|
136
|
+
|`Generic HTML5 elements`|✅ Supported|
|
137
|
+
|`<style>`|✅ Supported|
|
138
|
+
|`<link rel="stylesheet">`|✅ Supported|
|
139
|
+
|`<link rel="icon">`|❌ Not supported|
|
140
|
+
|`<img src="">`|✅ Supported|
|
141
|
+
|`<img srcset="">`|❌ Not supported|
|
142
|
+
|`<picture>`|❌ Not supported|
|
143
|
+
|`<svg>`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
144
|
+
|`<h1>-<h6>`|✅ Supported|
|
145
|
+
|`<ul>/<ol>`|✅ Supported|
|
146
|
+
|`<i>/<em>`|✅ Supported|
|
147
|
+
|`<b>/<strong>`|✅ Supported|
|
148
|
+
|`<u>`|✅ Supported|
|
149
|
+
|`<center>`|✅ Supported|
|
150
|
+
|`<pre>/<blockquote>`|✅ Supported|
|
151
|
+
|`<a>`|✅ Supported|
|
152
|
+
|`<br>`|✅ Supported|
|
153
|
+
|`<hr>`|❌ Not supported|
|
154
|
+
|`<details>/<summary>`|❌ Not supported|
|
155
|
+
|`<table>`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
156
|
+
|`Form Controls`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
157
|
+
|
158
|
+
|CSS|Status|
|
159
|
+
|-|-|
|
160
|
+
|`display:inline, display:block, display:inline-block`|✅ Supported|
|
161
|
+
|`display:none`|✅ Supported|
|
162
|
+
|`display:flex`|✅ Supported|
|
163
|
+
|`display:grid`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
164
|
+
|`display:table`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
165
|
+
|`display:contents`|❌ Not supported|
|
166
|
+
|`position:relative, position:absolute`|✅ Supported|
|
167
|
+
|`position:static, position:fixed, position:sticky`|❌ Not supported|
|
168
|
+
|`overflow`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
169
|
+
|`z-index`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
170
|
+
|`box-sizing`|✅ Supported|
|
171
|
+
|`float`|❌ Not supported|
|
172
|
+
|`content (::before / ::after)`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
173
|
+
|`opacity, visibility`|✅ Supported|
|
174
|
+
|`width, height`|✅ Supported|
|
175
|
+
|`min-width, max-width, min-height, max-height`|✅ Supported|
|
176
|
+
|`padding, margin, gap`|✅ Supported|
|
177
|
+
|`border`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
178
|
+
|`@font-face, font-size, font-family`|✅ Supported|
|
179
|
+
|`font-weight, font-style, font-stretch`|✅ Supported|
|
180
|
+
|`font-display, font-variant, font-feature-settings`|❌ Not supported|
|
181
|
+
|`color, text-align, line-height, text-decoration`|✅ Supported|
|
182
|
+
|`letter-spacing, overlap-wrap, word-wrap, word-break`|✅ Supported|
|
183
|
+
|`vertical-align, text-transform, text-overflow`|❌ Not supported|
|
184
|
+
|`border`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
|
185
|
+
|`background-color, background-image`|✅ Supported|
|
186
|
+
|`background-size, background-position`|✅ Supported|
|
187
|
+
|`background-repeat, background-clip, background-origin`|✅ Supported|
|
188
|
+
|`background-attachment`|❌ Not supported|
|
189
|
+
|`box-shadow`|✅ Supported|
|
190
|
+
|`filter`|❌ Not supported|
|
191
|
+
|
124
192
|
# How it works
|
125
193
|
|
126
194
|
No browser, just basics!
|
@@ -150,6 +218,7 @@ To play nicely with Rails a template handler is registered, which Rails' `defaul
|
|
150
218
|
- http://localhost:3000/users/jamedjo.himg will also render the same png
|
151
219
|
- http://localhost:3000/users/jamedjo will render an HTML page with opengraph meta tags
|
152
220
|
6. To install this gem onto your local machine, run `bundle exec rake install`.
|
221
|
+
7. To simulate a headless server environment without a GPU, use `WGPU_BACKEND=empty bundle exec rspec`
|
153
222
|
|
154
223
|
### Run cargo example directly generate image in Rust
|
155
224
|
|
data/lib/himg/3.2/himg.so
CHANGED
Binary file
|
Binary file
|
data/lib/himg/3.4/himg.so
CHANGED
Binary file
|
data/lib/himg/cli.rb
CHANGED
@@ -12,6 +12,7 @@ module Himg
|
|
12
12
|
option :verbose, type: :boolean, desc: "Enables detailed logging for debugging and profiling.", default: false
|
13
13
|
option :disable_fetch, type: :boolean, desc: "Skip fetching file/http resources (stylesheets, images, fonts, etc)", default: false
|
14
14
|
option :fetch_timeout, type: :numeric, desc: "Timeout in seconds for fetching resources", default: 10
|
15
|
+
option :gpu, type: :boolean, desc: "Use GPU renderer instead of CPU renderer", default: false
|
15
16
|
option :http_headers, desc: "HTTP Headers to use when fetching remote resource"
|
16
17
|
option :base_url, desc: "Base URL used to resolve relative URLs"
|
17
18
|
|
data/lib/himg/version.rb
CHANGED
data/lib/himg.rb
CHANGED
@@ -17,10 +17,10 @@ end
|
|
17
17
|
#
|
18
18
|
# Converts HTML to an Image for a minimal subset of HTML and CSS
|
19
19
|
module Himg
|
20
|
-
RENDER_OPTIONS = %i[width height truncate verbose].freeze
|
20
|
+
RENDER_OPTIONS = %i[width height truncate verbose base_url disable_fetch fetch_timeout gpu].freeze
|
21
21
|
class Error < StandardError; end
|
22
22
|
|
23
|
-
def self.render(html, width: 720, height: 405, truncate: true, verbose: false, base_url: nil, disable_fetch: false, fetch_timeout: 10)
|
24
|
-
render_to_string(html, "width" => width.to_i, "height" => height.to_i, "truncate" => truncate, "verbose" => verbose, "base_url" => BaseUrl.new(base_url).to_s, "disable_fetch" => disable_fetch, "fetch_timeout" => fetch_timeout.to_f)
|
23
|
+
def self.render(html, width: 720, height: 405, truncate: true, verbose: false, base_url: nil, disable_fetch: false, fetch_timeout: 10, gpu: false)
|
24
|
+
render_to_string(html, "width" => width.to_i, "height" => height.to_i, "truncate" => truncate, "verbose" => verbose, "base_url" => BaseUrl.new(base_url).to_s, "disable_fetch" => disable_fetch, "fetch_timeout" => fetch_timeout.to_f, "gpu" => gpu)
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: himg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- James Edwards-Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- gemfiles/rails_8.gemfile.lock
|
174
174
|
- lib/himg.rb
|
175
175
|
- lib/himg/3.2/himg.so
|
176
|
+
- lib/himg/3.3/himg.so
|
176
177
|
- lib/himg/3.4/himg.so
|
177
178
|
- lib/himg/base_url.rb
|
178
179
|
- lib/himg/cli.rb
|