Compare commits
No commits in common. "644effd" and "master" have entirely different histories.
112
README.md
112
README.md
|
@ -1,74 +1,118 @@
|
|||
# Yiffy Paintings
|
||||
Replaces the default paintings with yiff. Supports 1.6+
|
||||
|
||||
### Sources
|
||||
* [alban](https://e621.net/posts/1101130)
|
||||
* [aztec](https://e621.net/posts/537087)
|
||||
* [aztec2](https://e621.net/posts/426790)
|
||||
* [bomb](https://e621.net/posts/1680202)
|
||||
* [burning_skull](https://e621.net/posts/773268)
|
||||
* [bust](https://e621.net/posts/2008022)
|
||||
* [courbet](https://e621.net/posts/1746859)
|
||||
* [creebet](https://e621.net/posts/406661)
|
||||
* [donkey_kong](https://e621.net/posts/1375064)
|
||||
* [fighters](https://e621.net/posts/1881510)
|
||||
* [graham](https://e621.net/posts/1533304)
|
||||
* [kebab](https://e621.net/posts/1571695)
|
||||
* [match](https://e621.net/posts/1352699)
|
||||
* [pigscene](https://e621.net/posts/1518055)
|
||||
* [plant](https://e621.net/posts/1194572)
|
||||
* [pointer](https://e621.net/pools/8368)
|
||||
* [pool](https://e621.net/posts/854139)
|
||||
* [sea](https://e621.net/posts/2939687)
|
||||
* [skeleton](https://e621.net/posts/979894)
|
||||
* [skulls\_and\_roses](https://e621.net/posts/1599707)
|
||||
* [stage](https://e621.net/posts/314664)
|
||||
* [sunset](https://e621.net/posts/2333033)
|
||||
* [void](https://e621.net/posts/704825)
|
||||
* [wanderer](https://e621.net/posts/956366)
|
||||
* [wasteland](https://e621.net/posts/464478)
|
||||
* [wither](https://e621.net/posts/1683783)
|
||||
* [water](https://e621.net/posts/2827630)
|
||||
* [fire](https://e621.net/posts/2984756)
|
||||
* [earth](https://e621.net/posts/4394369)
|
||||
* [wind](https://e621.net/posts/4025061)
|
||||
|
||||
### Examples
|
||||
|
||||
<details>
|
||||
<summary>1x1</summary>
|
||||
|
||||
* [kebab](https://e621.net/posts/1571695)
|
||||
* [aztec](https://e621.net/posts/537087)
|
||||
* [alban](https://e621.net/posts/1101130)
|
||||
* [aztec2](https://e621.net/posts/426790)
|
||||
* [bomb](https://e621.net/posts/1680202)
|
||||
* [plant](https://e621.net/posts/1194572)
|
||||
* [wasteland](https://e621.net/posts/464478)
|
||||
* [meditative](https://e621.net/posts/3355209) (1.21+)
|
||||
|
||||
<img src="examples/1x1.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>1x2</summary>
|
||||
|
||||
* [wanderer](https://e621.net/posts/956366)
|
||||
* [graham](https://e621.net/posts/1533304)
|
||||
* [prairie_ride](https://e621.net/posts/4005374) (1.21+)
|
||||
|
||||
<img src="examples/1x2.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2x1</summary>
|
||||
|
||||
* [pool](https://e621.net/posts/854139)
|
||||
* [courbet](https://e621.net/posts/1746859)
|
||||
* [sunset](https://e621.net/posts/2333033)
|
||||
* [sea](https://e621.net/posts/2939687)
|
||||
* [creebet](https://e621.net/posts/406661)
|
||||
|
||||
<img src="examples/2x1.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2x2</summary>
|
||||
|
||||
* [match](https://e621.net/posts/1352699)
|
||||
* [bust](https://e621.net/posts/2008022)
|
||||
* [stage](https://e621.net/posts/314664)
|
||||
* [void](https://e621.net/posts/704825)
|
||||
* [skull\_and\_roses](https://e621.net/posts/1599707)
|
||||
* [wither](https://e621.net/posts/1683783)
|
||||
* [baroque](https://e621.net/posts/4524310) (1.21+)
|
||||
* [humble](https://e621.net/posts/3293255) (1.21+)
|
||||
* [earth](https://e621.net/posts/4394369) (1.19+)
|
||||
* [wind](https://e621.net/posts/4025061) (1.19+)
|
||||
* [fire](https://e621.net/posts/2984756) (1.19+)
|
||||
* [water](https://e621.net/posts/2827630) (1.19+)
|
||||
|
||||
<img src="examples/2x2.png" width="80%">
|
||||
<p>Water, Fire, Earth, Wind - [22w16a+ (1.19+)](https://minecraft.wiki/w/Painting#Unused_paintings)</p>
|
||||
<img src="examples/2x2-wfew.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>3x3</summary>
|
||||
|
||||
* [bouquet](https://e621.net/posts/4420140) (1.21+)
|
||||
* [cavebird](https://e621.net/posts/2433070) (1.21+)
|
||||
* [cotan](https://e621.net/posts/2255060) (1.21+)
|
||||
* [endboss](https://e621.net/posts/4543670) (1.21+)
|
||||
* [fern](https://e621.net/posts/1339799) (1.21+)
|
||||
* [owlemons](https://e621.net/posts/4623032) (1.21+)
|
||||
* [sunflowers](https://e621.net/posts/4626501) (1.21+)
|
||||
* [tides](https://e621.net/posts/4642340) (1.21+)
|
||||
|
||||
<img src="examples/3x3.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>3x4</summary>
|
||||
|
||||
* [backyard](https://e621.net/posts/4155856) (1.21+)
|
||||
* [pond](https://e621.net/posts/3935565) (1.21+)
|
||||
|
||||
<img src="examples/3x4.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>4x2</summary>
|
||||
|
||||
* [fighters](https://e621.net/posts/1881510)
|
||||
* [changing](https://e621.net/posts/3317590) (1.21+)
|
||||
* [finding](https://e621.net/posts/1818640) (1.21+)
|
||||
* [lowmist](https://e621.net/posts/1345861) (1.21+)
|
||||
* [passage](https://e621.net/posts/4152001) (1.21+)
|
||||
|
||||
<img src="examples/4x2.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>4x3</summary>
|
||||
|
||||
* [skeleton](https://e621.net/posts/979894)
|
||||
* [donkey_kong](https://e621.net/posts/1375064)
|
||||
|
||||
<img src="examples/4x3.png" width="80%">
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>4x4</summary>
|
||||
|
||||
* [burning_skull](https://e621.net/posts/773268)
|
||||
* [pigscene](https://e621.net/posts/1518055)
|
||||
* [pointer](https://e621.net/pools/8368)
|
||||
* [unpacked](https://e621.net/posts/3543944) (1.21+)
|
||||
* [orb](https://e621.net/posts/2626566) (1.21+)
|
||||
|
||||
<img src="examples/4x4.png" width="80%">
|
||||
</details>
|
||||
|
||||
|
|
BIN
data-kz/assets/minecraft/textures/painting/paintings_kristoffer_zetterstrand.png
(Stored with Git LFS)
BIN
data-kz/assets/minecraft/textures/painting/paintings_kristoffer_zetterstrand.png
(Stored with Git LFS)
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/backyard.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/backyard.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
{"animation":{"frametime":3}}
|
BIN
data/assets/minecraft/textures/painting/baroque.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/baroque.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
{"animation":{}}
|
BIN
data/assets/minecraft/textures/painting/bouquet.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/bouquet.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/cavebird.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/cavebird.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/changing.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/changing.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/cotan.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/cotan.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/endboss.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/endboss.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/fern.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/fern.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/finding.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/finding.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/graham.png
(Stored with Git LFS)
BIN
data/assets/minecraft/textures/painting/graham.png
(Stored with Git LFS)
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/humble.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/humble.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/kebab.png
(Stored with Git LFS)
BIN
data/assets/minecraft/textures/painting/kebab.png
(Stored with Git LFS)
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/lowmist.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/lowmist.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/meditative.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/meditative.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
{"animation":{}}
|
BIN
data/assets/minecraft/textures/painting/orb.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/orb.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/owlemons.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/owlemons.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/passage.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/passage.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/plant.png
(Stored with Git LFS)
BIN
data/assets/minecraft/textures/painting/plant.png
(Stored with Git LFS)
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/pond.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/pond.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/prairie_ride.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/prairie_ride.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/sunflowers.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/sunflowers.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/tides.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/tides.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/unpacked.png
(Stored with Git LFS)
Normal file
BIN
data/assets/minecraft/textures/painting/unpacked.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
data/assets/minecraft/textures/painting/wanderer.png
(Stored with Git LFS)
BIN
data/assets/minecraft/textures/painting/wanderer.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/1x1.png
(Stored with Git LFS)
BIN
examples/1x1.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/1x2.png
(Stored with Git LFS)
BIN
examples/1x2.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/2x1.png
(Stored with Git LFS)
BIN
examples/2x1.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/2x2-wfew.png
(Stored with Git LFS)
BIN
examples/2x2-wfew.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/2x2.png
(Stored with Git LFS)
BIN
examples/2x2.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/3x3.png
(Stored with Git LFS)
Normal file
BIN
examples/3x3.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
examples/3x4.png
(Stored with Git LFS)
Normal file
BIN
examples/3x4.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
examples/4x2.png
(Stored with Git LFS)
BIN
examples/4x2.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/4x3.png
(Stored with Git LFS)
BIN
examples/4x3.png
(Stored with Git LFS)
Binary file not shown.
BIN
examples/4x4.png
(Stored with Git LFS)
BIN
examples/4x4.png
(Stored with Git LFS)
Binary file not shown.
BIN
images/backyard.webm
(Stored with Git LFS)
Normal file
BIN
images/backyard.webm
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/baroque.webm
(Stored with Git LFS)
Normal file
BIN
images/baroque.webm
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/bouquet.png
(Stored with Git LFS)
Normal file
BIN
images/bouquet.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/cavebird.jpg
(Stored with Git LFS)
Normal file
BIN
images/cavebird.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/changing.png
(Stored with Git LFS)
Normal file
BIN
images/changing.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/cotan.png
(Stored with Git LFS)
Normal file
BIN
images/cotan.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/endboss.png
(Stored with Git LFS)
Normal file
BIN
images/endboss.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/fern.jpg
(Stored with Git LFS)
Normal file
BIN
images/fern.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/finding.jpg
(Stored with Git LFS)
Normal file
BIN
images/finding.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/humble.png
(Stored with Git LFS)
Normal file
BIN
images/humble.png
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -48,7 +48,7 @@
|
|||
"kz": [6, 0]
|
||||
},
|
||||
{
|
||||
"name": "meditation",
|
||||
"name": "meditative",
|
||||
"size": "1x1",
|
||||
"kz": null
|
||||
},
|
||||
|
@ -89,6 +89,7 @@
|
|||
"size": "1x2",
|
||||
"kz": [1, 4],
|
||||
"resize": [320, 320],
|
||||
"frames": [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58],
|
||||
"_comment": "For some reason this needs to be 1:1"
|
||||
},
|
||||
{
|
||||
|
@ -156,7 +157,9 @@
|
|||
{
|
||||
"name": "baroque",
|
||||
"size": "2x2",
|
||||
"kz": null
|
||||
"kz": null,
|
||||
"frames": { "start": 60, "end": 140 },
|
||||
"resize": [320, 320]
|
||||
},
|
||||
{
|
||||
"name": "humble",
|
||||
|
@ -200,7 +203,7 @@
|
|||
"size": "4x4",
|
||||
"kz": [8, 12],
|
||||
"resize": [320, 320],
|
||||
"frames": [2805, 2826]
|
||||
"frames": { "start": 2805, "end": 2826 }
|
||||
},
|
||||
{
|
||||
"name": "unpacked",
|
||||
|
@ -265,7 +268,11 @@
|
|||
{
|
||||
"name": "backyard",
|
||||
"size": "3x4",
|
||||
"kz": null
|
||||
"kz": null,
|
||||
"resize": [640, 640],
|
||||
"frames": [3, 6, 12, 15, 18],
|
||||
"animation": { "frametime": 3 },
|
||||
"_comment": "For some reason this needs to be 1:1"
|
||||
},
|
||||
{
|
||||
"name": "pond",
|
||||
|
|
BIN
images/lowmist.png
(Stored with Git LFS)
Normal file
BIN
images/lowmist.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/meditative.gif
(Stored with Git LFS)
Normal file
BIN
images/meditative.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/orb.png
(Stored with Git LFS)
Normal file
BIN
images/orb.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/owlemons.png
(Stored with Git LFS)
Normal file
BIN
images/owlemons.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/passage.png
(Stored with Git LFS)
Normal file
BIN
images/passage.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/pond.png
(Stored with Git LFS)
Normal file
BIN
images/pond.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/prairie_ride.png
(Stored with Git LFS)
Normal file
BIN
images/prairie_ride.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/sunflowers.jpg
(Stored with Git LFS)
Normal file
BIN
images/sunflowers.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -1,22 +1,23 @@
|
|||
{
|
||||
"sizes": {
|
||||
"1x1": [640, 640],
|
||||
"1x2": [640, 1280],
|
||||
"2x1": [1280, 640],
|
||||
"2x2": [1280, 1280],
|
||||
"3x3": [1920, 1920],
|
||||
"3x4": [1920, 2560],
|
||||
"4x2": [2560, 1280],
|
||||
"4x3": [2560, 1920],
|
||||
"4x4": [2560, 2560]
|
||||
"1x1": [320, 320],
|
||||
"1x2": [320, 640],
|
||||
"2x1": [640, 320],
|
||||
"2x2": [640, 640],
|
||||
"3x3": [960, 960],
|
||||
"3x4": [960, 1280],
|
||||
"4x2": [1280, 640],
|
||||
"4x3": [1280, 960],
|
||||
"4x4": [1280, 1280]
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"name": "burning_skull",
|
||||
"size": "4x4",
|
||||
"kz": [8, 12],
|
||||
"resize": [620, 620],
|
||||
"frames": [2805, 2826]
|
||||
"name": "graham",
|
||||
"size": "1x2",
|
||||
"kz": [1, 4],
|
||||
"resize": [320, 320],
|
||||
"frames": [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58],
|
||||
"_comment": "For some reason this needs to be 1:1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
BIN
images/tides.png
(Stored with Git LFS)
Normal file
BIN
images/tides.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
images/unpacked.jpg
(Stored with Git LFS)
Normal file
BIN
images/unpacked.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -18,7 +18,8 @@
|
|||
["1.20", 15],
|
||||
["1.20.2", 18],
|
||||
["1.20.3", 26],
|
||||
["1.20.5", 32]
|
||||
["1.20.5", 32],
|
||||
["1.21", 34]
|
||||
],
|
||||
"exports": [],
|
||||
"overrides": {
|
||||
|
|
67
list.txt
Normal file
67
list.txt
Normal file
|
@ -0,0 +1,67 @@
|
|||
1x1
|
||||
- kebab
|
||||
- aztec
|
||||
- alban
|
||||
- aztec2
|
||||
- bomb
|
||||
- plant
|
||||
- wasteland
|
||||
- meditative (1.21+)
|
||||
|
||||
1x2
|
||||
- wanderer
|
||||
- graham
|
||||
- prairie_ride (1.21+)
|
||||
|
||||
2x1
|
||||
- pool
|
||||
- courbet
|
||||
- sunset
|
||||
- sea
|
||||
- creebet
|
||||
|
||||
2x2
|
||||
- match
|
||||
- bust
|
||||
- stage
|
||||
- void
|
||||
- skull_and_roses
|
||||
- wither
|
||||
- baroque (1.21+)
|
||||
- humble (1.21+)
|
||||
- earth (1.19+)
|
||||
- wind (1.19+)
|
||||
- fire (1.19+)
|
||||
- water (1.19+)
|
||||
|
||||
3x3
|
||||
- bouquet (1.21+)
|
||||
- cavebird (1.21+)
|
||||
- cotan (1.21+)
|
||||
- endboss (1.21+)
|
||||
- fern (1.21+)
|
||||
- owlemons (1.21+)
|
||||
- sunflowers (1.21+)
|
||||
- tides (1.21+)
|
||||
|
||||
3x4
|
||||
- backyard (1.21+)
|
||||
- pond (1.21+)
|
||||
|
||||
4x2
|
||||
- fighters
|
||||
- changing (1.21+)
|
||||
- finding (1.21+)
|
||||
- lowmist (1.21+)
|
||||
- passage (1.21+)
|
||||
|
||||
4x3
|
||||
- skeleton
|
||||
- donkey_kong
|
||||
|
||||
4x4
|
||||
- pointer
|
||||
- pigscene
|
||||
- burning_skull
|
||||
- unpacked (1.21+)
|
||||
- orb (1.21+)
|
|
@ -8,7 +8,7 @@ import { tmpdir } from "os";
|
|||
import { basename } from "path";
|
||||
import sharp, { type OverlayOptions, type Sharp } from "sharp";
|
||||
|
||||
export async function formatImage(name: string, image: string | string[], frameColors: number[], framePercent: number, width: number, height: number, resizeWidth?: number, resizeHeight?: number, frames?: [start: number, end: number], saveKz?: boolean) {
|
||||
export async function formatImage(name: string, image: string | string[], frameColors: number[], framePercent: number, width: number, height: number, resizeWidth?: number, resizeHeight?: number, frames?: { start: number; end?: number; } | number[], saveKz?: boolean) {
|
||||
saveKz ??= false;
|
||||
const originalWidth = width, originalHeight = height;
|
||||
const originalFrameVH = Math.floor(Math.min(originalWidth, originalHeight) * framePercent);
|
||||
|
@ -37,11 +37,18 @@ export async function formatImage(name: string, image: string | string[], frameC
|
|||
let files: string[] = [];
|
||||
tmpDir = await mkdtemp(`${tmpdir()}/split-frames-`);
|
||||
if (!Array.isArray(image)) {
|
||||
const [start = 0, end = null] = frames ?? [];
|
||||
let select = "";
|
||||
if (Array.isArray(frames)) {
|
||||
select = frames.map(f => `eq(n\\,${f})`).join("+");
|
||||
} else if (frames) {
|
||||
select = `gte(n\\, ${frames.start})${frames.end ? `*lte(n\\,${frames.end}` : ""})`;
|
||||
} else {
|
||||
select = "n";
|
||||
}
|
||||
console.debug("Input file %s is not an image, assuming we need to extract frames.", name);
|
||||
await new Promise<void>((resolve) => {
|
||||
Ffmpeg(image)
|
||||
.videoFilter(`scale=${inputWidth}:${inputHeight}${end !== null ? `,select='gte(n\\, ${start})*lte(n\\,${end})'` : ""}`)
|
||||
.videoFilter(`scale=${inputWidth}:${inputHeight},select='${select}'`)
|
||||
.addOption("-vsync vfr")
|
||||
.output(`${tmpDir}/frame%04d.png`)
|
||||
.on("end", async() => {
|
||||
|
@ -56,11 +63,12 @@ export async function formatImage(name: string, image: string | string[], frameC
|
|||
console.log("Frames extracted to %s, %d total for %s", tmpDir, files.length, name);
|
||||
resolve();
|
||||
})
|
||||
.on("error", async() => {
|
||||
.on("error", async(err) => {
|
||||
if (tmpDir) {
|
||||
await rm(tmpDir, { recursive: true });
|
||||
}
|
||||
console.error("Failed to extract frames for %s.", name);
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
})
|
||||
.run()
|
||||
|
|
|
@ -66,7 +66,7 @@ await mkdir(ap(kzOutDir), { recursive: true });
|
|||
|
||||
interface Image {
|
||||
animation?: { frametime?: number; };
|
||||
frames?: [start: number, end: number];
|
||||
frames?: { start: number; end?: number; } | number[];
|
||||
kz: [x: number, y: number] | null;
|
||||
name: string;
|
||||
resize?: [width: number, height: number];
|
||||
|
|
Loading…
Reference in New Issue
Block a user