himg 0.0.6 → 0.0.8

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: 2b2129ecb9c51fef4cb5937b84cb79ffb17880b514f787870272e152f27c75f3
4
- data.tar.gz: 72f3bf4d34326c362093a94ef77dbb460ef766930465cf04c7db6a3cff1a5dd4
3
+ metadata.gz: 625354e25f75ba2a83205c62b3cf2cc6fbe883d48c701a09703e863cc647cea3
4
+ data.tar.gz: 775eac3d3644b056adadea5c2075698c8c9bdce680cdca4478edf7add902c51b
5
5
  SHA512:
6
- metadata.gz: 1d37eedb7061da5062c3115256f53d9011ba7498b45ca4c2d83e61838c81f87261561c7e3b8bdfc7eac0c8241a66d1b5c8413fc36fe0cda67bbc639ae254a366
7
- data.tar.gz: 539f6f154e7414412e4c5b86505bededd930398a9f909d489787b395493a774bc1786011a1056689b75f61c38a4aa24de3b0e727cf88e66a8f85c9a16d55f55d
6
+ metadata.gz: 8e5d7496bc2008a8864b0b53412fbe1455e4761124cf5870d5ee271ac4e0c241828129a29dfbce83c2c1747d5c4e5914017da644c64cf4dff0cc9a6f90817e76
7
+ data.tar.gz: dbb75e11cf3b155287b5af1b2cefb5f305c56ba1001c212df6beaa862d48f09888ee6a48b40c111aaddfd3fdaf3645651d764a9d33a33e45c8cbfb8bf0c09ace
data/CHANGELOG.md CHANGED
@@ -1,7 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
+
4
+ ## [0.0.8] - 2025-07-31
5
+
6
+ - Return to GPU rendering by default: quality is low with CPU rendering.
7
+ - Compile native Apple darwin/macos gems for intel and arm.
8
+ - Remove debug symbols saving 315MB on the binary size.
9
+
10
+ ## [0.0.7] - 2025-07-29
11
+
12
+ - Added `fetch_timeout` option to control restrict how long can be spent fetching resources.
13
+ - Move bin/himg to exe/himg so bundler can install it in on the users PATH.
14
+
3
15
  ## [0.0.6] - 2025-07-23
4
16
 
17
+ - Updates to latest blitz
18
+ - Renders on CPU instead of GPU (experimental)
5
19
  - Added bin/himg CLI screenshot tool
6
20
  - Added `base_url` option for configuring relative paths
7
21
  - Added `disable_fetch` option for security hardening
data/Cargo.lock CHANGED
@@ -38,6 +38,15 @@ version = "0.2.21"
38
38
  source = "registry+https://github.com/rust-lang/crates.io-index"
39
39
  checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
40
40
 
41
+ [[package]]
42
+ name = "android_system_properties"
43
+ version = "0.1.5"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
46
+ dependencies = [
47
+ "libc",
48
+ ]
49
+
41
50
  [[package]]
42
51
  name = "anyrender"
43
52
  version = "0.5.0"
@@ -64,15 +73,20 @@ dependencies = [
64
73
  ]
65
74
 
66
75
  [[package]]
67
- name = "anyrender_vello_cpu"
76
+ name = "anyrender_vello"
68
77
  version = "0.5.0"
69
78
  source = "registry+https://github.com/rust-lang/crates.io-index"
70
- checksum = "76e722679b9a2eea9db17748c3c05c09899bbefeb1f46ee2b3c192ad1f9631be"
79
+ checksum = "3baba14afab3466d9c2cb61afc8d27810e2209807affd945295ec6d47c2166c3"
71
80
  dependencies = [
72
81
  "anyrender",
82
+ "futures-intrusive",
73
83
  "kurbo",
74
84
  "peniko",
75
- "vello_cpu",
85
+ "pollster",
86
+ "raw-window-handle",
87
+ "rustc-hash",
88
+ "vello",
89
+ "wgpu",
76
90
  ]
77
91
 
78
92
  [[package]]
@@ -97,6 +111,15 @@ version = "0.7.6"
97
111
  source = "registry+https://github.com/rust-lang/crates.io-index"
98
112
  checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
99
113
 
114
+ [[package]]
115
+ name = "ash"
116
+ version = "0.38.0+1.3.281"
117
+ source = "registry+https://github.com/rust-lang/crates.io-index"
118
+ checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
119
+ dependencies = [
120
+ "libloading",
121
+ ]
122
+
100
123
  [[package]]
101
124
  name = "atomic-waker"
102
125
  version = "1.1.2"
@@ -156,6 +179,21 @@ dependencies = [
156
179
  "syn",
157
180
  ]
158
181
 
182
+ [[package]]
183
+ name = "bit-set"
184
+ version = "0.8.0"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
187
+ dependencies = [
188
+ "bit-vec",
189
+ ]
190
+
191
+ [[package]]
192
+ name = "bit-vec"
193
+ version = "0.8.0"
194
+ source = "registry+https://github.com/rust-lang/crates.io-index"
195
+ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
196
+
159
197
  [[package]]
160
198
  name = "bitflags"
161
199
  version = "1.3.2"
@@ -268,6 +306,12 @@ dependencies = [
268
306
  "url",
269
307
  ]
270
308
 
309
+ [[package]]
310
+ name = "block"
311
+ version = "0.1.6"
312
+ source = "registry+https://github.com/rust-lang/crates.io-index"
313
+ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
314
+
271
315
  [[package]]
272
316
  name = "bumpalo"
273
317
  version = "3.19.0"
@@ -336,6 +380,12 @@ version = "1.0.1"
336
380
  source = "registry+https://github.com/rust-lang/crates.io-index"
337
381
  checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
338
382
 
383
+ [[package]]
384
+ name = "cfg_aliases"
385
+ version = "0.2.1"
386
+ source = "registry+https://github.com/rust-lang/crates.io-index"
387
+ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
388
+
339
389
  [[package]]
340
390
  name = "clang-sys"
341
391
  version = "1.8.1"
@@ -347,14 +397,21 @@ dependencies = [
347
397
  "libloading",
348
398
  ]
349
399
 
400
+ [[package]]
401
+ name = "codespan-reporting"
402
+ version = "0.11.1"
403
+ source = "registry+https://github.com/rust-lang/crates.io-index"
404
+ checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
405
+ dependencies = [
406
+ "termcolor",
407
+ "unicode-width",
408
+ ]
409
+
350
410
  [[package]]
351
411
  name = "color"
352
412
  version = "0.3.1"
353
413
  source = "registry+https://github.com/rust-lang/crates.io-index"
354
414
  checksum = "7ae467d04a8a8aea5d9a49018a6ade2e4221d92968e8ce55a48c0b1164e5f698"
355
- dependencies = [
356
- "bytemuck",
357
- ]
358
415
 
359
416
  [[package]]
360
417
  name = "color_quant"
@@ -378,6 +435,17 @@ version = "0.8.7"
378
435
  source = "registry+https://github.com/rust-lang/crates.io-index"
379
436
  checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
380
437
 
438
+ [[package]]
439
+ name = "core-graphics-types"
440
+ version = "0.1.3"
441
+ source = "registry+https://github.com/rust-lang/crates.io-index"
442
+ checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
443
+ dependencies = [
444
+ "bitflags 1.3.2",
445
+ "core-foundation",
446
+ "libc",
447
+ ]
448
+
381
449
  [[package]]
382
450
  name = "core_maths"
383
451
  version = "0.1.1"
@@ -522,6 +590,15 @@ dependencies = [
522
590
  "syn",
523
591
  ]
524
592
 
593
+ [[package]]
594
+ name = "document-features"
595
+ version = "0.2.11"
596
+ source = "registry+https://github.com/rust-lang/crates.io-index"
597
+ checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
598
+ dependencies = [
599
+ "litrs",
600
+ ]
601
+
525
602
  [[package]]
526
603
  name = "dtoa"
527
604
  version = "1.0.10"
@@ -692,7 +769,28 @@ version = "0.3.2"
692
769
  source = "registry+https://github.com/rust-lang/crates.io-index"
693
770
  checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
694
771
  dependencies = [
695
- "foreign-types-shared",
772
+ "foreign-types-shared 0.1.1",
773
+ ]
774
+
775
+ [[package]]
776
+ name = "foreign-types"
777
+ version = "0.5.0"
778
+ source = "registry+https://github.com/rust-lang/crates.io-index"
779
+ checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
780
+ dependencies = [
781
+ "foreign-types-macros",
782
+ "foreign-types-shared 0.3.1",
783
+ ]
784
+
785
+ [[package]]
786
+ name = "foreign-types-macros"
787
+ version = "0.2.3"
788
+ source = "registry+https://github.com/rust-lang/crates.io-index"
789
+ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
790
+ dependencies = [
791
+ "proc-macro2",
792
+ "quote",
793
+ "syn",
696
794
  ]
697
795
 
698
796
  [[package]]
@@ -701,6 +799,12 @@ version = "0.1.1"
701
799
  source = "registry+https://github.com/rust-lang/crates.io-index"
702
800
  checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
703
801
 
802
+ [[package]]
803
+ name = "foreign-types-shared"
804
+ version = "0.3.1"
805
+ source = "registry+https://github.com/rust-lang/crates.io-index"
806
+ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
807
+
704
808
  [[package]]
705
809
  name = "form_urlencoded"
706
810
  version = "1.2.1"
@@ -735,6 +839,17 @@ version = "0.3.31"
735
839
  source = "registry+https://github.com/rust-lang/crates.io-index"
736
840
  checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
737
841
 
842
+ [[package]]
843
+ name = "futures-intrusive"
844
+ version = "0.5.0"
845
+ source = "registry+https://github.com/rust-lang/crates.io-index"
846
+ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
847
+ dependencies = [
848
+ "futures-core",
849
+ "lock_api",
850
+ "parking_lot",
851
+ ]
852
+
738
853
  [[package]]
739
854
  name = "futures-sink"
740
855
  version = "0.3.31"
@@ -807,18 +922,111 @@ version = "0.31.1"
807
922
  source = "registry+https://github.com/rust-lang/crates.io-index"
808
923
  checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
809
924
 
925
+ [[package]]
926
+ name = "gl_generator"
927
+ version = "0.14.0"
928
+ source = "registry+https://github.com/rust-lang/crates.io-index"
929
+ checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"
930
+ dependencies = [
931
+ "khronos_api",
932
+ "log",
933
+ "xml-rs",
934
+ ]
935
+
810
936
  [[package]]
811
937
  name = "glob"
812
938
  version = "0.3.2"
813
939
  source = "registry+https://github.com/rust-lang/crates.io-index"
814
940
  checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
815
941
 
942
+ [[package]]
943
+ name = "glow"
944
+ version = "0.16.0"
945
+ source = "registry+https://github.com/rust-lang/crates.io-index"
946
+ checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08"
947
+ dependencies = [
948
+ "js-sys",
949
+ "slotmap",
950
+ "wasm-bindgen",
951
+ "web-sys",
952
+ ]
953
+
954
+ [[package]]
955
+ name = "glutin_wgl_sys"
956
+ version = "0.6.1"
957
+ source = "registry+https://github.com/rust-lang/crates.io-index"
958
+ checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e"
959
+ dependencies = [
960
+ "gl_generator",
961
+ ]
962
+
963
+ [[package]]
964
+ name = "gpu-alloc"
965
+ version = "0.6.0"
966
+ source = "registry+https://github.com/rust-lang/crates.io-index"
967
+ checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
968
+ dependencies = [
969
+ "bitflags 2.9.1",
970
+ "gpu-alloc-types",
971
+ ]
972
+
973
+ [[package]]
974
+ name = "gpu-alloc-types"
975
+ version = "0.3.0"
976
+ source = "registry+https://github.com/rust-lang/crates.io-index"
977
+ checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
978
+ dependencies = [
979
+ "bitflags 2.9.1",
980
+ ]
981
+
982
+ [[package]]
983
+ name = "gpu-allocator"
984
+ version = "0.27.0"
985
+ source = "registry+https://github.com/rust-lang/crates.io-index"
986
+ checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd"
987
+ dependencies = [
988
+ "log",
989
+ "presser",
990
+ "thiserror 1.0.69",
991
+ "windows",
992
+ ]
993
+
994
+ [[package]]
995
+ name = "gpu-descriptor"
996
+ version = "0.3.2"
997
+ source = "registry+https://github.com/rust-lang/crates.io-index"
998
+ checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
999
+ dependencies = [
1000
+ "bitflags 2.9.1",
1001
+ "gpu-descriptor-types",
1002
+ "hashbrown",
1003
+ ]
1004
+
1005
+ [[package]]
1006
+ name = "gpu-descriptor-types"
1007
+ version = "0.2.0"
1008
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1009
+ checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
1010
+ dependencies = [
1011
+ "bitflags 2.9.1",
1012
+ ]
1013
+
816
1014
  [[package]]
817
1015
  name = "grid"
818
1016
  version = "0.17.0"
819
1017
  source = "registry+https://github.com/rust-lang/crates.io-index"
820
1018
  checksum = "71b01d27060ad58be4663b9e4ac9e2d4806918e8876af8912afbddd1a91d5eaa"
821
1019
 
1020
+ [[package]]
1021
+ name = "guillotiere"
1022
+ version = "0.6.2"
1023
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1024
+ checksum = "b62d5865c036cb1393e23c50693df631d3f5d7bcca4c04fe4cc0fd592e74a782"
1025
+ dependencies = [
1026
+ "euclid",
1027
+ "svg_fmt",
1028
+ ]
1029
+
822
1030
  [[package]]
823
1031
  name = "h2"
824
1032
  version = "0.4.11"
@@ -849,18 +1057,30 @@ dependencies = [
849
1057
  "foldhash",
850
1058
  ]
851
1059
 
1060
+ [[package]]
1061
+ name = "heck"
1062
+ version = "0.5.0"
1063
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1064
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
1065
+
852
1066
  [[package]]
853
1067
  name = "hermit-abi"
854
1068
  version = "0.5.2"
855
1069
  source = "registry+https://github.com/rust-lang/crates.io-index"
856
1070
  checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
857
1071
 
1072
+ [[package]]
1073
+ name = "hexf-parse"
1074
+ version = "0.2.1"
1075
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1076
+ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
1077
+
858
1078
  [[package]]
859
1079
  name = "himg"
860
- version = "0.0.6"
1080
+ version = "0.0.8"
861
1081
  dependencies = [
862
1082
  "anyrender",
863
- "anyrender_vello_cpu",
1083
+ "anyrender_vello",
864
1084
  "blitz-dom",
865
1085
  "blitz-html",
866
1086
  "blitz-net",
@@ -1294,6 +1514,12 @@ version = "1.0.15"
1294
1514
  source = "registry+https://github.com/rust-lang/crates.io-index"
1295
1515
  checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
1296
1516
 
1517
+ [[package]]
1518
+ name = "jni-sys"
1519
+ version = "0.3.0"
1520
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1521
+ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
1522
+
1297
1523
  [[package]]
1298
1524
  name = "js-sys"
1299
1525
  version = "0.3.77"
@@ -1315,6 +1541,23 @@ dependencies = [
1315
1541
  "unicode-segmentation",
1316
1542
  ]
1317
1543
 
1544
+ [[package]]
1545
+ name = "khronos-egl"
1546
+ version = "6.0.0"
1547
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1548
+ checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
1549
+ dependencies = [
1550
+ "libc",
1551
+ "libloading",
1552
+ "pkg-config",
1553
+ ]
1554
+
1555
+ [[package]]
1556
+ name = "khronos_api"
1557
+ version = "3.1.0"
1558
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1559
+ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
1560
+
1318
1561
  [[package]]
1319
1562
  name = "kurbo"
1320
1563
  version = "0.11.3"
@@ -1378,6 +1621,12 @@ version = "0.8.0"
1378
1621
  source = "registry+https://github.com/rust-lang/crates.io-index"
1379
1622
  checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
1380
1623
 
1624
+ [[package]]
1625
+ name = "litrs"
1626
+ version = "0.4.2"
1627
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1628
+ checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed"
1629
+
1381
1630
  [[package]]
1382
1631
  name = "lock_api"
1383
1632
  version = "0.4.13"
@@ -1423,6 +1672,15 @@ dependencies = [
1423
1672
  "syn",
1424
1673
  ]
1425
1674
 
1675
+ [[package]]
1676
+ name = "malloc_buf"
1677
+ version = "0.0.6"
1678
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1679
+ checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
1680
+ dependencies = [
1681
+ "libc",
1682
+ ]
1683
+
1426
1684
  [[package]]
1427
1685
  name = "malloc_size_of_derive"
1428
1686
  version = "0.1.3"
@@ -1477,6 +1735,21 @@ dependencies = [
1477
1735
  "libc",
1478
1736
  ]
1479
1737
 
1738
+ [[package]]
1739
+ name = "metal"
1740
+ version = "0.31.0"
1741
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1742
+ checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e"
1743
+ dependencies = [
1744
+ "bitflags 2.9.1",
1745
+ "block",
1746
+ "core-graphics-types",
1747
+ "foreign-types 0.5.0",
1748
+ "log",
1749
+ "objc",
1750
+ "paste",
1751
+ ]
1752
+
1480
1753
  [[package]]
1481
1754
  name = "mime"
1482
1755
  version = "0.3.17"
@@ -1510,6 +1783,28 @@ dependencies = [
1510
1783
  "windows-sys 0.59.0",
1511
1784
  ]
1512
1785
 
1786
+ [[package]]
1787
+ name = "naga"
1788
+ version = "24.0.0"
1789
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1790
+ checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e"
1791
+ dependencies = [
1792
+ "arrayvec",
1793
+ "bit-set",
1794
+ "bitflags 2.9.1",
1795
+ "cfg_aliases",
1796
+ "codespan-reporting",
1797
+ "hexf-parse",
1798
+ "indexmap",
1799
+ "log",
1800
+ "rustc-hash",
1801
+ "spirv",
1802
+ "strum",
1803
+ "termcolor",
1804
+ "thiserror 2.0.12",
1805
+ "unicode-xid",
1806
+ ]
1807
+
1513
1808
  [[package]]
1514
1809
  name = "native-tls"
1515
1810
  version = "0.2.14"
@@ -1527,6 +1822,15 @@ dependencies = [
1527
1822
  "tempfile",
1528
1823
  ]
1529
1824
 
1825
+ [[package]]
1826
+ name = "ndk-sys"
1827
+ version = "0.5.0+25.2.9519653"
1828
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1829
+ checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691"
1830
+ dependencies = [
1831
+ "jni-sys",
1832
+ ]
1833
+
1530
1834
  [[package]]
1531
1835
  name = "new_debug_unreachable"
1532
1836
  version = "1.0.6"
@@ -1582,6 +1886,15 @@ dependencies = [
1582
1886
  "libc",
1583
1887
  ]
1584
1888
 
1889
+ [[package]]
1890
+ name = "objc"
1891
+ version = "0.2.7"
1892
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1893
+ checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
1894
+ dependencies = [
1895
+ "malloc_buf",
1896
+ ]
1897
+
1585
1898
  [[package]]
1586
1899
  name = "objc2"
1587
1900
  version = "0.6.1"
@@ -1649,7 +1962,7 @@ checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8"
1649
1962
  dependencies = [
1650
1963
  "bitflags 2.9.1",
1651
1964
  "cfg-if",
1652
- "foreign-types",
1965
+ "foreign-types 0.3.2",
1653
1966
  "libc",
1654
1967
  "once_cell",
1655
1968
  "openssl-macros",
@@ -1695,6 +2008,15 @@ dependencies = [
1695
2008
  "vcpkg",
1696
2009
  ]
1697
2010
 
2011
+ [[package]]
2012
+ name = "ordered-float"
2013
+ version = "4.6.0"
2014
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2015
+ checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951"
2016
+ dependencies = [
2017
+ "num-traits",
2018
+ ]
2019
+
1698
2020
  [[package]]
1699
2021
  name = "parking_lot"
1700
2022
  version = "0.12.4"
@@ -1731,13 +2053,18 @@ dependencies = [
1731
2053
  "swash",
1732
2054
  ]
1733
2055
 
2056
+ [[package]]
2057
+ name = "paste"
2058
+ version = "1.0.15"
2059
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2060
+ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
2061
+
1734
2062
  [[package]]
1735
2063
  name = "peniko"
1736
2064
  version = "0.4.0"
1737
2065
  source = "registry+https://github.com/rust-lang/crates.io-index"
1738
2066
  checksum = "1f9529efd019889b2a205193c14ffb6e2839b54ed9d2720674f10f4b04d87ac9"
1739
2067
  dependencies = [
1740
- "bytemuck",
1741
2068
  "color",
1742
2069
  "kurbo",
1743
2070
  "smallvec",
@@ -1838,6 +2165,12 @@ dependencies = [
1838
2165
  "miniz_oxide",
1839
2166
  ]
1840
2167
 
2168
+ [[package]]
2169
+ name = "pollster"
2170
+ version = "0.4.0"
2171
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2172
+ checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"
2173
+
1841
2174
  [[package]]
1842
2175
  name = "potential_utf"
1843
2176
  version = "0.1.2"
@@ -1853,6 +2186,12 @@ version = "0.1.1"
1853
2186
  source = "registry+https://github.com/rust-lang/crates.io-index"
1854
2187
  checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
1855
2188
 
2189
+ [[package]]
2190
+ name = "presser"
2191
+ version = "0.3.1"
2192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2193
+ checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
2194
+
1856
2195
  [[package]]
1857
2196
  name = "proc-macro2"
1858
2197
  version = "1.0.95"
@@ -1862,6 +2201,12 @@ dependencies = [
1862
2201
  "unicode-ident",
1863
2202
  ]
1864
2203
 
2204
+ [[package]]
2205
+ name = "profiling"
2206
+ version = "1.0.17"
2207
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2208
+ checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
2209
+
1865
2210
  [[package]]
1866
2211
  name = "quick-error"
1867
2212
  version = "2.0.1"
@@ -1898,6 +2243,12 @@ version = "0.6.4"
1898
2243
  source = "registry+https://github.com/rust-lang/crates.io-index"
1899
2244
  checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
1900
2245
 
2246
+ [[package]]
2247
+ name = "range-alloc"
2248
+ version = "0.1.4"
2249
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2250
+ checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde"
2251
+
1901
2252
  [[package]]
1902
2253
  name = "raw-window-handle"
1903
2254
  version = "0.6.2"
@@ -2029,6 +2380,12 @@ version = "0.8.5"
2029
2380
  source = "registry+https://github.com/rust-lang/crates.io-index"
2030
2381
  checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
2031
2382
 
2383
+ [[package]]
2384
+ name = "renderdoc-sys"
2385
+ version = "1.1.0"
2386
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2387
+ checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
2388
+
2032
2389
  [[package]]
2033
2390
  name = "reqwest"
2034
2391
  version = "0.12.22"
@@ -2394,6 +2751,15 @@ dependencies = [
2394
2751
  "windows-sys 0.52.0",
2395
2752
  ]
2396
2753
 
2754
+ [[package]]
2755
+ name = "spirv"
2756
+ version = "0.3.0+sdk-1.3.268.0"
2757
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2758
+ checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
2759
+ dependencies = [
2760
+ "bitflags 2.9.1",
2761
+ ]
2762
+
2397
2763
  [[package]]
2398
2764
  name = "stable_deref_trait"
2399
2765
  version = "1.2.0"
@@ -2440,6 +2806,28 @@ dependencies = [
2440
2806
  "quote",
2441
2807
  ]
2442
2808
 
2809
+ [[package]]
2810
+ name = "strum"
2811
+ version = "0.26.3"
2812
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2813
+ checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
2814
+ dependencies = [
2815
+ "strum_macros",
2816
+ ]
2817
+
2818
+ [[package]]
2819
+ name = "strum_macros"
2820
+ version = "0.26.4"
2821
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2822
+ checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
2823
+ dependencies = [
2824
+ "heck",
2825
+ "proc-macro2",
2826
+ "quote",
2827
+ "rustversion",
2828
+ "syn",
2829
+ ]
2830
+
2443
2831
  [[package]]
2444
2832
  name = "stylo"
2445
2833
  version = "0.4.0"
@@ -2599,6 +2987,12 @@ version = "2.6.1"
2599
2987
  source = "registry+https://github.com/rust-lang/crates.io-index"
2600
2988
  checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
2601
2989
 
2990
+ [[package]]
2991
+ name = "svg_fmt"
2992
+ version = "0.4.5"
2993
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2994
+ checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb"
2995
+
2602
2996
  [[package]]
2603
2997
  name = "svgtypes"
2604
2998
  version = "0.15.3"
@@ -2708,6 +3102,15 @@ dependencies = [
2708
3102
  "utf-8",
2709
3103
  ]
2710
3104
 
3105
+ [[package]]
3106
+ name = "termcolor"
3107
+ version = "1.4.1"
3108
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3109
+ checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
3110
+ dependencies = [
3111
+ "winapi-util",
3112
+ ]
3113
+
2711
3114
  [[package]]
2712
3115
  name = "thin-vec"
2713
3116
  version = "0.2.14"
@@ -3036,6 +3439,18 @@ version = "0.1.0"
3036
3439
  source = "registry+https://github.com/rust-lang/crates.io-index"
3037
3440
  checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
3038
3441
 
3442
+ [[package]]
3443
+ name = "unicode-width"
3444
+ version = "0.1.14"
3445
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3446
+ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
3447
+
3448
+ [[package]]
3449
+ name = "unicode-xid"
3450
+ version = "0.2.6"
3451
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3452
+ checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
3453
+
3039
3454
  [[package]]
3040
3455
  name = "untrusted"
3041
3456
  version = "0.9.0"
@@ -3106,25 +3521,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
3106
3521
  checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
3107
3522
 
3108
3523
  [[package]]
3109
- name = "vello_common"
3110
- version = "0.0.1"
3524
+ name = "vello"
3525
+ version = "0.5.0"
3111
3526
  source = "registry+https://github.com/rust-lang/crates.io-index"
3112
- checksum = "6b5e49f2836e87b6bd3d8f70324696f22b5f7dfdc836caeab463fff05957c1b1"
3527
+ checksum = "df026e62e8b0d12d55ff5e91ae9114a20f82d9b856bedfdbf3abd5d1472dceed"
3113
3528
  dependencies = [
3114
3529
  "bytemuck",
3530
+ "futures-intrusive",
3531
+ "log",
3115
3532
  "peniko",
3116
3533
  "png",
3117
3534
  "skrifa",
3535
+ "static_assertions",
3536
+ "thiserror 2.0.12",
3537
+ "vello_encoding",
3538
+ "vello_shaders",
3539
+ "wgpu",
3540
+ ]
3541
+
3542
+ [[package]]
3543
+ name = "vello_encoding"
3544
+ version = "0.5.0"
3545
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3546
+ checksum = "3c5702642f6ea77eedc12d119e1eebead0dba3cf91fe5c5d1f3efc12bf0cfaf1"
3547
+ dependencies = [
3548
+ "bytemuck",
3549
+ "guillotiere",
3550
+ "peniko",
3551
+ "skrifa",
3118
3552
  "smallvec",
3119
3553
  ]
3120
3554
 
3121
3555
  [[package]]
3122
- name = "vello_cpu"
3123
- version = "0.0.1"
3556
+ name = "vello_shaders"
3557
+ version = "0.5.0"
3124
3558
  source = "registry+https://github.com/rust-lang/crates.io-index"
3125
- checksum = "a45e0a6b777abb4354e15146ecf95bac03aada7a85024fd47762f56095b32896"
3559
+ checksum = "381790a3779021edd9f88267c1b13b49546cb0fb164f329ee2f2587869ddf459"
3126
3560
  dependencies = [
3127
- "vello_common",
3561
+ "bytemuck",
3562
+ "naga",
3563
+ "thiserror 2.0.12",
3564
+ "vello_encoding",
3128
3565
  ]
3129
3566
 
3130
3567
  [[package]]
@@ -3272,6 +3709,115 @@ version = "0.1.10"
3272
3709
  source = "registry+https://github.com/rust-lang/crates.io-index"
3273
3710
  checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3"
3274
3711
 
3712
+ [[package]]
3713
+ name = "wgpu"
3714
+ version = "24.0.5"
3715
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3716
+ checksum = "6b0b3436f0729f6cdf2e6e9201f3d39dc95813fad61d826c1ed07918b4539353"
3717
+ dependencies = [
3718
+ "arrayvec",
3719
+ "bitflags 2.9.1",
3720
+ "cfg_aliases",
3721
+ "document-features",
3722
+ "js-sys",
3723
+ "log",
3724
+ "naga",
3725
+ "parking_lot",
3726
+ "profiling",
3727
+ "raw-window-handle",
3728
+ "smallvec",
3729
+ "static_assertions",
3730
+ "wasm-bindgen",
3731
+ "wasm-bindgen-futures",
3732
+ "web-sys",
3733
+ "wgpu-core",
3734
+ "wgpu-hal",
3735
+ "wgpu-types",
3736
+ ]
3737
+
3738
+ [[package]]
3739
+ name = "wgpu-core"
3740
+ version = "24.0.5"
3741
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3742
+ checksum = "7f0aa306497a238d169b9dc70659105b4a096859a34894544ca81719242e1499"
3743
+ dependencies = [
3744
+ "arrayvec",
3745
+ "bit-vec",
3746
+ "bitflags 2.9.1",
3747
+ "cfg_aliases",
3748
+ "document-features",
3749
+ "indexmap",
3750
+ "log",
3751
+ "naga",
3752
+ "once_cell",
3753
+ "parking_lot",
3754
+ "profiling",
3755
+ "raw-window-handle",
3756
+ "rustc-hash",
3757
+ "smallvec",
3758
+ "thiserror 2.0.12",
3759
+ "wgpu-hal",
3760
+ "wgpu-types",
3761
+ ]
3762
+
3763
+ [[package]]
3764
+ name = "wgpu-hal"
3765
+ version = "24.0.4"
3766
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3767
+ checksum = "f112f464674ca69f3533248508ee30cb84c67cf06c25ff6800685f5e0294e259"
3768
+ dependencies = [
3769
+ "android_system_properties",
3770
+ "arrayvec",
3771
+ "ash",
3772
+ "bit-set",
3773
+ "bitflags 2.9.1",
3774
+ "block",
3775
+ "bytemuck",
3776
+ "cfg_aliases",
3777
+ "core-graphics-types",
3778
+ "glow",
3779
+ "glutin_wgl_sys",
3780
+ "gpu-alloc",
3781
+ "gpu-allocator",
3782
+ "gpu-descriptor",
3783
+ "js-sys",
3784
+ "khronos-egl",
3785
+ "libc",
3786
+ "libloading",
3787
+ "log",
3788
+ "metal",
3789
+ "naga",
3790
+ "ndk-sys",
3791
+ "objc",
3792
+ "once_cell",
3793
+ "ordered-float",
3794
+ "parking_lot",
3795
+ "profiling",
3796
+ "range-alloc",
3797
+ "raw-window-handle",
3798
+ "renderdoc-sys",
3799
+ "rustc-hash",
3800
+ "smallvec",
3801
+ "thiserror 2.0.12",
3802
+ "wasm-bindgen",
3803
+ "web-sys",
3804
+ "wgpu-types",
3805
+ "windows",
3806
+ "windows-core",
3807
+ ]
3808
+
3809
+ [[package]]
3810
+ name = "wgpu-types"
3811
+ version = "24.0.0"
3812
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3813
+ checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c"
3814
+ dependencies = [
3815
+ "bitflags 2.9.1",
3816
+ "js-sys",
3817
+ "log",
3818
+ "web-sys",
3819
+ ]
3820
+
3275
3821
  [[package]]
3276
3822
  name = "winapi-util"
3277
3823
  version = "0.1.9"
@@ -3557,6 +4103,12 @@ version = "0.6.1"
3557
4103
  source = "registry+https://github.com/rust-lang/crates.io-index"
3558
4104
  checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
3559
4105
 
4106
+ [[package]]
4107
+ name = "xml-rs"
4108
+ version = "0.8.27"
4109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
4110
+ checksum = "6fd8403733700263c6eb89f192880191f1b83e332f7a20371ddcf421c4a337c7"
4111
+
3560
4112
  [[package]]
3561
4113
  name = "xml5ever"
3562
4114
  version = "0.35.0"
data/Cargo.toml CHANGED
@@ -5,9 +5,3 @@
5
5
  [workspace]
6
6
  members = ["./ext/himg"]
7
7
  resolver = "2"
8
-
9
- [profile.release]
10
- # By default, debug symbols are stripped from the final binary which makes it
11
- # harder to debug if something goes wrong. As we don't mind a larger binary size
12
- # we can keep these in the release build so that you can debug if needed.
13
- debug = true
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  You give it HTML and it gives back an image!
4
4
 
5
- Parses a minimal subset of HTML/CSS, fetches nested resources, renders an image on the GPU. No browser, no fuss.
5
+ Parses HTML/CSS, fetches nested resources, renders an image. No browser, no fuss.
6
+
7
+ Perfect for OpenGraph images - stop losing clicks to boring links by adding a rich image preview that showcases your content.
6
8
 
7
9
  ![Mockup showing HTML being transformed into a WhatsApp preview](/readme_hero.svg)
8
10
 
@@ -11,8 +13,9 @@ Parses a minimal subset of HTML/CSS, fetches nested resources, renders an image
11
13
  ### Command Line
12
14
 
13
15
  ```bash
14
- bin/himg screenshot path/to/your.html screenshot.png
15
- bin/himg screenshot https://github.com/Jamedjo/himg himg.png --width=1024 --verbose --no-truncate
16
+ gem install himg
17
+ himg screenshot path/to/your.html screenshot.png
18
+ himg screenshot https://github.com/Jamedjo/himg himg.png --width=1024 --verbose --no-truncate
16
19
  ```
17
20
 
18
21
  ### Ruby
@@ -63,6 +66,7 @@ bundle add himg
63
66
  |verbose | Enables detailed logging for debugging and profiling. | bool | false |
64
67
  |base_url | Where relative paths are relative to for linked resources (stylesheets, images, fonts, etc) | string | nil |
65
68
  |disable_fetch | Disables fetching linked resources from disk and network| bool | false |
69
+ |fetch_timeout | Timeout in seconds for fetching resources | float | 10.0 |
66
70
 
67
71
 
68
72
  ### Passing options to a Rails view template
@@ -118,6 +122,72 @@ respond_to do |format|
118
122
  end
119
123
  ```
120
124
 
125
+ # Supported HTML and CSS
126
+
127
+ Himg supports a large subset of the HTML and CSS you'd need to get by, but not all elements or properties are supported.
128
+
129
+ For a full list, see our [snapshot of the blitz.is status page](https://github.com/Jamedjo/himg/issues/2).
130
+
131
+ 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).
132
+
133
+ |HTML|Status|
134
+ |-|-|
135
+ |`Generic HTML5 elements`|✅ Supported|
136
+ |`<style>`|✅ Supported|
137
+ |`<link rel="stylesheet">`|✅ Supported|
138
+ |`<link rel="icon">`|❌ Not supported|
139
+ |`<img src="">`|✅ Supported|
140
+ |`<img srcset="">`|❌ Not supported|
141
+ |`<picture>`|❌ Not supported|
142
+ |`<svg>`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
143
+ |`<h1>-<h6>`|✅ Supported|
144
+ |`<ul>/<ol>`|✅ Supported|
145
+ |`<i>/<em>`|✅ Supported|
146
+ |`<b>/<strong>`|✅ Supported|
147
+ |`<u>`|✅ Supported|
148
+ |`<center>`|✅ Supported|
149
+ |`<pre>/<blockquote>`|✅ Supported|
150
+ |`<a>`|✅ Supported|
151
+ |`<br>`|✅ Supported|
152
+ |`<hr>`|❌ Not supported|
153
+ |`<details>/<summary>`|❌ Not supported|
154
+ |`<table>`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
155
+ |`Form Controls`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
156
+
157
+ |CSS|Status|
158
+ |-|-|
159
+ |`display:inline, display:block, display:inline-block`|✅ Supported|
160
+ |`display:none`|✅ Supported|
161
+ |`display:flex`|✅ Supported|
162
+ |`display:grid`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
163
+ |`display:table`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
164
+ |`display:contents`|❌ Not supported|
165
+ |`position:relative, position:absolute`|✅ Supported|
166
+ |`position:static, position:fixed, position:sticky`|❌ Not supported|
167
+ |`overflow`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
168
+ |`z-index`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
169
+ |`box-sizing`|✅ Supported|
170
+ |`float`|❌ Not supported|
171
+ |`content (::before / ::after)`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
172
+ |`opacity, visibility`|✅ Supported|
173
+ |`width, height`|✅ Supported|
174
+ |`min-width, max-width, min-height, max-height`|✅ Supported|
175
+ |`padding, margin, gap`|✅ Supported|
176
+ |`border`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
177
+ |`@font-face, font-size, font-family`|✅ Supported|
178
+ |`font-weight, font-style, font-stretch`|✅ Supported|
179
+ |`font-display, font-variant, font-feature-settings`|❌ Not supported|
180
+ |`color, text-align, line-height, text-decoration`|✅ Supported|
181
+ |`letter-spacing, overlap-wrap, word-wrap, word-break`|✅ Supported|
182
+ |`vertical-align, text-transform, text-overflow`|❌ Not supported|
183
+ |`border`|⚠️ [Partial support](https://github.com/Jamedjo/himg/issues/2)|
184
+ |`background-color, background-image`|✅ Supported|
185
+ |`background-size, background-position`|✅ Supported|
186
+ |`background-repeat, background-clip, background-origin`|✅ Supported|
187
+ |`background-attachment`|❌ Not supported|
188
+ |`box-shadow`|✅ Supported|
189
+ |`filter`|❌ Not supported|
190
+
121
191
  # How it works
122
192
 
123
193
  No browser, just basics!
@@ -130,7 +200,7 @@ To play nicely with Rails a template handler is registered, which Rails' `defaul
130
200
 
131
201
  ## CAVEATS
132
202
 
133
- 1. This is **pre-alpha** software, don't expect it to work yet.
203
+ 1. This is **pre-alpha** software, don't expect it to work perfectly yet.
134
204
  2. Performance needs tuning. Both in the underlying blitz library and how data is passed between Rust and Ruby
135
205
  3. Network requests can be made: don't use this library with untrusted inputs. Use `disable_fetch` if you don't need to fetch any resources.
136
206
  4. file:// URLs are resolved: this could expose files on your computer. Use `disable_fetch` if you don't need to fetch any resources.
data/exe/himg ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+
5
+ require "himg"
6
+ require "himg/cli"
7
+ Himg::CLI.start(ARGV)
data/ext/himg/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "himg"
3
3
  description = "ruby bindings to expose a blitz html->png pipeline"
4
- version = "0.0.6"
4
+ version = "0.0.8"
5
5
  edition = "2024"
6
6
  authors = ["James Edwards-Jones <git@jamedjo.co.uk>"]
7
7
  license = "MIT"
@@ -19,17 +19,12 @@ blitz-dom = { version = "0.1.0-rc.1" }
19
19
  blitz-net = { version = "0.1.0-rc.1" }
20
20
  blitz-paint = { version = "0.1.0-rc.1" }
21
21
  anyrender = { version = "0.5.0" }
22
- anyrender_vello_cpu = { version = "0.5.0" }
22
+ anyrender_vello = { version = "0.5.0" }
23
23
  blitz-html = { version = "0.1.0-rc.1" }
24
24
  tokio = { version = "1.46", features = ["rt-multi-thread", "macros"] }
25
25
  png = "0.17"
26
26
  openssl = { version = "0.10", features = ["vendored"] }
27
27
 
28
- #euclid = { workspace = true }
29
- #image = { workspace = true }
30
- #env_logger = "0.11"
31
- #tracing-subscriber = "0.3"
32
-
33
28
  [build-dependencies]
34
29
  rb-sys-env = "0.2.2"
35
30
 
@@ -34,6 +34,7 @@ async fn main() {
34
34
  verbose: true,
35
35
  color_scheme: ColorScheme::Light,
36
36
  disable_fetch: false,
37
+ fetch_timeout: 10.0,
37
38
  base_url: Some(base_url),
38
39
  };
39
40
 
@@ -1,9 +1,10 @@
1
1
  use blitz_html::HtmlDocument;
2
2
  use blitz_dom::DocumentConfig;
3
- use anyrender_vello_cpu::VelloCpuImageRenderer;
3
+ use anyrender_vello::VelloImageRenderer;
4
4
  use anyrender::render_to_buffer;
5
5
  use blitz_paint::paint_scene;
6
6
  use blitz_traits::shell::{Viewport};
7
+ use tokio::time::{timeout, Duration};
7
8
 
8
9
  use crate::image_size::ImageSize;
9
10
  use crate::logger::Logger;
@@ -50,8 +51,10 @@ pub async fn html_to_image(
50
51
  ));
51
52
 
52
53
  if let Some(ref mut net_fetcher) = net_fetcher {
53
- net_fetcher.fetch_resources(&mut document).await;
54
- logger.log("Fetched assets");
54
+ match timeout(Duration::from_millis((options.fetch_timeout * 1000.0) as u64), net_fetcher.fetch_resources(&mut document)).await {
55
+ Ok(_) => logger.log("Fetched assets"),
56
+ Err(_) => logger.log("Timeout fetching assets"),
57
+ }
55
58
  }
56
59
 
57
60
  // Compute style, layout, etc for HtmlDocument
@@ -76,7 +79,7 @@ pub async fn html_to_image(
76
79
  }
77
80
 
78
81
  // Render document to RGBA buffer
79
- let buffer = render_to_buffer::<VelloCpuImageRenderer, _>(
82
+ let buffer = render_to_buffer::<VelloImageRenderer, _>(
80
83
  |scene| paint_scene(
81
84
  scene,
82
85
  document.as_ref(),
data/ext/himg/src/lib.rs CHANGED
@@ -12,7 +12,6 @@ pub use options::Options;
12
12
  pub use html_to_image::html_to_image;
13
13
  pub use writer::write_png;
14
14
 
15
- use blitz_traits::shell::ColorScheme;
16
15
  use magnus::{function, prelude::*, ExceptionClass, Error, Ruby, RString, RHash};
17
16
 
18
17
  impl Options {
@@ -26,15 +25,16 @@ impl Options {
26
25
 
27
26
  let options = Options {
28
27
  image_size: ImageSize {
29
- width: hash.lookup2("width", 720)?,
30
- height: hash.lookup2("height", 405)?,
31
- hidpi_scale: 1.0,
28
+ width: hash.lookup2("width", defaults.image_size.width)?,
29
+ height: hash.lookup2("height", defaults.image_size.height)?,
30
+ hidpi_scale: defaults.image_size.hidpi_scale,
32
31
  },
33
- truncate: hash.lookup2("truncate", true)?,
34
- verbose: hash.lookup2("verbose", false)?,
32
+ truncate: hash.lookup2("truncate", defaults.truncate)?,
33
+ verbose: hash.lookup2("verbose", defaults.verbose)?,
35
34
  base_url: hash.lookup("base_url")?,
36
- disable_fetch: hash.lookup2("disable_fetch", false)?,
37
- color_scheme: ColorScheme::Light,
35
+ disable_fetch: hash.lookup2("disable_fetch", defaults.disable_fetch)?,
36
+ fetch_timeout: hash.lookup2("fetch_timeout", defaults.fetch_timeout)?,
37
+ color_scheme: defaults.color_scheme,
38
38
  };
39
39
 
40
40
  Ok(options)
@@ -7,6 +7,7 @@ pub struct Options {
7
7
  pub image_size: ImageSize,
8
8
  pub color_scheme: ColorScheme,
9
9
  pub disable_fetch: bool,
10
+ pub fetch_timeout: f64,
10
11
  pub base_url: Option<String>,
11
12
  pub truncate: bool,
12
13
  pub verbose: bool,
@@ -24,6 +25,7 @@ impl Options {
24
25
  verbose: false,
25
26
  base_url: None,
26
27
  disable_fetch: false,
28
+ fetch_timeout: 10.0,
27
29
  color_scheme: ColorScheme::Light,
28
30
  }
29
31
  }
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- himg (0.0.5)
4
+ himg (0.0.6)
5
5
  rb_sys (~> 0.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- himg (0.0.5)
4
+ himg (0.0.6)
5
5
  rb_sys (~> 0.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- himg (0.0.5)
4
+ himg (0.0.6)
5
5
  rb_sys (~> 0.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- himg (0.0.5)
4
+ himg (0.0.6)
5
5
  rb_sys (~> 0.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- himg (0.0.5)
4
+ himg (0.0.6)
5
5
  rb_sys (~> 0.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- himg (0.0.5)
4
+ himg (0.0.6)
5
5
  rb_sys (~> 0.9)
6
6
 
7
7
  GEM
data/lib/himg/cli.rb CHANGED
@@ -11,6 +11,7 @@ module Himg
11
11
  option :truncate, type: :boolean, desc: "Keeps the image height fixed instead of expanding to include the full page.", default: true
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
+ option :fetch_timeout, type: :numeric, desc: "Timeout in seconds for fetching resources", default: 10
14
15
  option :http_headers, desc: "HTTP Headers to use when fetching remote resource"
15
16
  option :base_url, desc: "Base URL used to resolve relative URLs"
16
17
 
data/lib/himg/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Himg
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.8"
5
5
  end
data/lib/himg.rb CHANGED
@@ -20,7 +20,7 @@ module Himg
20
20
  RENDER_OPTIONS = %i[width height truncate verbose].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)
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)
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)
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: himg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edwards-Jones
@@ -149,10 +149,12 @@ dependencies:
149
149
  - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
- description: You give it HTML and it renders an Image!
152
+ description: You give it HTML and it renders an Image! No browser required. Perfect
153
+ for OpenGraph social cards so your links don't look boring when shared.
153
154
  email:
154
155
  - git@jamedjo.co.uk
155
- executables: []
156
+ executables:
157
+ - himg
156
158
  extensions:
157
159
  - ext/himg/extconf.rb
158
160
  extra_rdoc_files: []
@@ -169,6 +171,7 @@ files:
169
171
  - README.md
170
172
  - Rakefile
171
173
  - Steepfile
174
+ - exe/himg
172
175
  - ext/himg/Cargo.lock
173
176
  - ext/himg/Cargo.toml
174
177
  - ext/himg/build.rs
@@ -229,5 +232,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
232
  requirements: []
230
233
  rubygems_version: 3.6.7
231
234
  specification_version: 4
232
- summary: The Hyper Image Generator
235
+ summary: Renders HTML to an Image, perfect for OpenGraph social cards
233
236
  test_files: []