mirror of
https://github.com/danbulant/nekos
synced 2026-05-19 03:58:34 +00:00
fix aspect ratio for fonts
This commit is contained in:
parent
4699c190e8
commit
a40097a184
1 changed files with 3 additions and 3 deletions
6
nekos.js
6
nekos.js
|
|
@ -48,13 +48,13 @@ var sigint = false;
|
|||
async function parseFrames(fn) {
|
||||
return (await $`magick identify -format "%T %W %H\n" ${fn}`).stdout.split("\n")
|
||||
.map(t => t.split(" "))
|
||||
.map(t => ({ d: (1 / parseInt(t[0])) * 100, w: parseInt(t[1]), h: parseInt(t[2]) }))
|
||||
.map(t => ({ d: (1 / parseInt(t[0])) * 100, w: parseInt(t[1]) * 2.2, h: parseInt(t[2]) }))
|
||||
.map(t => {
|
||||
const scale = Math.min(sizes[1] / t.w, sizes[0] / (t.h - (verbose ? 1 : 0)));
|
||||
const scale = Math.min(sizes[1] / t.w, (sizes[0] - (verbose && fn.endsWith(".gif") ? 1 : 0)) / t.h);
|
||||
return {
|
||||
...t,
|
||||
sw: Math.floor(t.w * scale),
|
||||
sh: Math.floor(t.h * scale - (verbose ? 1 : 0)),
|
||||
sh: Math.floor((t.h - (verbose && fn.endsWith(".gif") ? 1 : 0)) * scale),
|
||||
scale
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue