Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Fuobe FX: sharp covers on large cards and 2x screens; the Upscale card rests on its sharp side

Adarsh5e2bd7ba26b2
diff --git a/public/previews/fx/character-swap/after.1440.avif b/public/previews/fx/character-swap/after.1440.avif
new file mode 100644
index 00000000..d290af2f
Binary files /dev/null and b/public/previews/fx/character-swap/after.1440.avif differ
diff --git a/public/previews/fx/character-swap/after.1440.webp b/public/previews/fx/character-swap/after.1440.webp
new file mode 100644
index 00000000..fef11b35
Binary files /dev/null and b/public/previews/fx/character-swap/after.1440.webp differ
diff --git a/public/previews/fx/character-swap/before.1440.avif b/public/previews/fx/character-swap/before.1440.avif
new file mode 100644
index 00000000..ae5ed1b6
Binary files /dev/null and b/public/previews/fx/character-swap/before.1440.avif differ
diff --git a/public/previews/fx/character-swap/before.1440.webp b/public/previews/fx/character-swap/before.1440.webp
new file mode 100644
index 00000000..33c6af9c
Binary files /dev/null and b/public/previews/fx/character-swap/before.1440.webp differ
diff --git a/public/previews/fx/color-grade/after.1440.avif b/public/previews/fx/color-grade/after.1440.avif
new file mode 100644
index 00000000..e0c4927b
Binary files /dev/null and b/public/previews/fx/color-grade/after.1440.avif differ
diff --git a/public/previews/fx/color-grade/after.1440.webp b/public/previews/fx/color-grade/after.1440.webp
new file mode 100644
index 00000000..e81bb491
Binary files /dev/null and b/public/previews/fx/color-grade/after.1440.webp differ
diff --git a/public/previews/fx/color-grade/before.1440.avif b/public/previews/fx/color-grade/before.1440.avif
new file mode 100644
index 00000000..240fc59f
Binary files /dev/null and b/public/previews/fx/color-grade/before.1440.avif differ
diff --git a/public/previews/fx/color-grade/before.1440.webp b/public/previews/fx/color-grade/before.1440.webp
new file mode 100644
index 00000000..13eec914
Binary files /dev/null and b/public/previews/fx/color-grade/before.1440.webp differ
diff --git a/public/previews/fx/genjutsu-restyle/after.1440.avif b/public/previews/fx/genjutsu-restyle/after.1440.avif
new file mode 100644
index 00000000..d456153e
Binary files /dev/null and b/public/previews/fx/genjutsu-restyle/after.1440.avif differ
diff --git a/public/previews/fx/genjutsu-restyle/after.1440.webp b/public/previews/fx/genjutsu-restyle/after.1440.webp
new file mode 100644
index 00000000..a03d0103
Binary files /dev/null and b/public/previews/fx/genjutsu-restyle/after.1440.webp differ
diff --git a/public/previews/fx/genjutsu-restyle/before.1440.avif b/public/previews/fx/genjutsu-restyle/before.1440.avif
new file mode 100644
index 00000000..4b33401e
Binary files /dev/null and b/public/previews/fx/genjutsu-restyle/before.1440.avif differ
diff --git a/public/previews/fx/genjutsu-restyle/before.1440.webp b/public/previews/fx/genjutsu-restyle/before.1440.webp
new file mode 100644
index 00000000..2e639b3a
Binary files /dev/null and b/public/previews/fx/genjutsu-restyle/before.1440.webp differ
diff --git a/public/previews/fx/inpaint/after.1440.avif b/public/previews/fx/inpaint/after.1440.avif
new file mode 100644
index 00000000..c6d0d985
Binary files /dev/null and b/public/previews/fx/inpaint/after.1440.avif differ
diff --git a/public/previews/fx/inpaint/after.1440.webp b/public/previews/fx/inpaint/after.1440.webp
new file mode 100644
index 00000000..36018a74
Binary files /dev/null and b/public/previews/fx/inpaint/after.1440.webp differ
diff --git a/public/previews/fx/inpaint/before.1440.avif b/public/previews/fx/inpaint/before.1440.avif
new file mode 100644
index 00000000..a351d9cd
Binary files /dev/null and b/public/previews/fx/inpaint/before.1440.avif differ
diff --git a/public/previews/fx/inpaint/before.1440.webp b/public/previews/fx/inpaint/before.1440.webp
new file mode 100644
index 00000000..af4197c6
Binary files /dev/null and b/public/previews/fx/inpaint/before.1440.webp differ
diff --git a/public/previews/fx/layers/after.1440.avif b/public/previews/fx/layers/after.1440.avif
new file mode 100644
index 00000000..12ffb032
Binary files /dev/null and b/public/previews/fx/layers/after.1440.avif differ
diff --git a/public/previews/fx/layers/after.1440.webp b/public/previews/fx/layers/after.1440.webp
new file mode 100644
index 00000000..bb87d061
Binary files /dev/null and b/public/previews/fx/layers/after.1440.webp differ
diff --git a/public/previews/fx/layers/before.1440.avif b/public/previews/fx/layers/before.1440.avif
new file mode 100644
index 00000000..d46d8b16
Binary files /dev/null and b/public/previews/fx/layers/before.1440.avif differ
diff --git a/public/previews/fx/layers/before.1440.webp b/public/previews/fx/layers/before.1440.webp
new file mode 100644
index 00000000..3ea94afe
Binary files /dev/null and b/public/previews/fx/layers/before.1440.webp differ
diff --git a/public/previews/fx/upscale-video/after.1440.avif b/public/previews/fx/upscale-video/after.1440.avif
new file mode 100644
index 00000000..ea755ea1
Binary files /dev/null and b/public/previews/fx/upscale-video/after.1440.avif differ
diff --git a/public/previews/fx/upscale-video/after.1440.webp b/public/previews/fx/upscale-video/after.1440.webp
new file mode 100644
index 00000000..a647ce57
Binary files /dev/null and b/public/previews/fx/upscale-video/after.1440.webp differ
diff --git a/public/previews/fx/upscale-video/before.1440.avif b/public/previews/fx/upscale-video/before.1440.avif
new file mode 100644
index 00000000..08dd1751
Binary files /dev/null and b/public/previews/fx/upscale-video/before.1440.avif differ
diff --git a/public/previews/fx/upscale-video/before.1440.webp b/public/previews/fx/upscale-video/before.1440.webp
new file mode 100644
index 00000000..ab2f8eba
Binary files /dev/null and b/public/previews/fx/upscale-video/before.1440.webp differ
diff --git a/public/previews/fx/upscale/after.1440.avif b/public/previews/fx/upscale/after.1440.avif
new file mode 100644
index 00000000..958f32bd
Binary files /dev/null and b/public/previews/fx/upscale/after.1440.avif differ
diff --git a/public/previews/fx/upscale/after.1440.webp b/public/previews/fx/upscale/after.1440.webp
new file mode 100644
index 00000000..967b1bf2
Binary files /dev/null and b/public/previews/fx/upscale/after.1440.webp differ
diff --git a/public/previews/fx/upscale/before.1440.avif b/public/previews/fx/upscale/before.1440.avif
new file mode 100644
index 00000000..52ed556a
Binary files /dev/null and b/public/previews/fx/upscale/before.1440.avif differ
diff --git a/public/previews/fx/upscale/before.1440.webp b/public/previews/fx/upscale/before.1440.webp
new file mode 100644
index 00000000..584a4b8a
Binary files /dev/null and b/public/previews/fx/upscale/before.1440.webp differ
diff --git a/public/previews/fx/video-tools-green-screen/after.1440.avif b/public/previews/fx/video-tools-green-screen/after.1440.avif
new file mode 100644
index 00000000..0ca6587e
Binary files /dev/null and b/public/previews/fx/video-tools-green-screen/after.1440.avif differ
diff --git a/public/previews/fx/video-tools-green-screen/after.1440.webp b/public/previews/fx/video-tools-green-screen/after.1440.webp
new file mode 100644
index 00000000..69756b26
Binary files /dev/null and b/public/previews/fx/video-tools-green-screen/after.1440.webp differ
diff --git a/public/previews/fx/video-tools-green-screen/before.1440.avif b/public/previews/fx/video-tools-green-screen/before.1440.avif
new file mode 100644
index 00000000..07d516f2
Binary files /dev/null and b/public/previews/fx/video-tools-green-screen/before.1440.avif differ
diff --git a/public/previews/fx/video-tools-green-screen/before.1440.webp b/public/previews/fx/video-tools-green-screen/before.1440.webp
new file mode 100644
index 00000000..09d893c5
Binary files /dev/null and b/public/previews/fx/video-tools-green-screen/before.1440.webp differ
diff --git a/public/previews/fx/video-tools-relight/after.1440.avif b/public/previews/fx/video-tools-relight/after.1440.avif
new file mode 100644
index 00000000..2b017f3c
Binary files /dev/null and b/public/previews/fx/video-tools-relight/after.1440.avif differ
diff --git a/public/previews/fx/video-tools-relight/after.1440.webp b/public/previews/fx/video-tools-relight/after.1440.webp
new file mode 100644
index 00000000..af3c353d
Binary files /dev/null and b/public/previews/fx/video-tools-relight/after.1440.webp differ
diff --git a/public/previews/fx/video-tools-relight/before.1440.avif b/public/previews/fx/video-tools-relight/before.1440.avif
new file mode 100644
index 00000000..79e76897
Binary files /dev/null and b/public/previews/fx/video-tools-relight/before.1440.avif differ
diff --git a/public/previews/fx/video-tools-relight/before.1440.webp b/public/previews/fx/video-tools-relight/before.1440.webp
new file mode 100644
index 00000000..84e65f96
Binary files /dev/null and b/public/previews/fx/video-tools-relight/before.1440.webp differ
diff --git a/public/previews/fx/video-tools-remove-object/after.1440.avif b/public/previews/fx/video-tools-remove-object/after.1440.avif
new file mode 100644
index 00000000..008f2b7c
Binary files /dev/null and b/public/previews/fx/video-tools-remove-object/after.1440.avif differ
diff --git a/public/previews/fx/video-tools-remove-object/after.1440.webp b/public/previews/fx/video-tools-remove-object/after.1440.webp
new file mode 100644
index 00000000..394aca4c
Binary files /dev/null and b/public/previews/fx/video-tools-remove-object/after.1440.webp differ
diff --git a/public/previews/fx/video-tools-remove-object/before.1440.avif b/public/previews/fx/video-tools-remove-object/before.1440.avif
new file mode 100644
index 00000000..2a9be4ac
Binary files /dev/null and b/public/previews/fx/video-tools-remove-object/before.1440.avif differ
diff --git a/public/previews/fx/video-tools-remove-object/before.1440.webp b/public/previews/fx/video-tools-remove-object/before.1440.webp
new file mode 100644
index 00000000..5bf1c645
Binary files /dev/null and b/public/previews/fx/video-tools-remove-object/before.1440.webp differ
diff --git a/public/previews/fx/video-tools-restore/after.1440.avif b/public/previews/fx/video-tools-restore/after.1440.avif
new file mode 100644
index 00000000..4309bc3f
Binary files /dev/null and b/public/previews/fx/video-tools-restore/after.1440.avif differ
diff --git a/public/previews/fx/video-tools-restore/after.1440.webp b/public/previews/fx/video-tools-restore/after.1440.webp
new file mode 100644
index 00000000..922ac036
Binary files /dev/null and b/public/previews/fx/video-tools-restore/after.1440.webp differ
diff --git a/public/previews/fx/video-tools-restore/before.1440.avif b/public/previews/fx/video-tools-restore/before.1440.avif
new file mode 100644
index 00000000..977c5d76
Binary files /dev/null and b/public/previews/fx/video-tools-restore/before.1440.avif differ
diff --git a/public/previews/fx/video-tools-restore/before.1440.webp b/public/previews/fx/video-tools-restore/before.1440.webp
new file mode 100644
index 00000000..00700aba
Binary files /dev/null and b/public/previews/fx/video-tools-restore/before.1440.webp differ
diff --git a/scripts/gen-fx-pairs.mjs b/scripts/gen-fx-pairs.mjs
index 59a8d3a5..e8158e60 100644
--- a/scripts/gen-fx-pairs.mjs
+++ b/scripts/gen-fx-pairs.mjs
@@ -7,12 +7,14 @@
* Output, per item id, in public/previews/fx/<id>/:
* before.480.webp, after.480.webp 480x360 (40 KB at most each), and the same as .avif
* before.960.webp, after.960.webp 960x720 for 2x screens, and the same as .avif
+ * before.1440.webp, after.1440.webp 1440x1080 for a large card on a 2x screen (the menu's lead), and the same as
+ * .avif: only when the after is at least 1400 px wide (`hd`), never enlarged
* kind "matte": the after is the cut-out on transparency (WebP and AVIF with alpha)
* kind "depth": the after is the depth pass
* kind "loupe": also before.loupe.webp and after.loupe.webp (240x240, and .loupe2x.webp at 480x480): the same 1:1
* detail of the after at its own resolution, and of the before enlarged to it
* kind "strip": also strip.webp: 6 frames of the real output clip side by side (each 480x360), in time order
- * kind "reframe": also wide.480.webp / wide.960.webp, the before as a 16:9 still, and `rect`, the 9:16 crop's box in
+ * kind "reframe": also wide.480.webp / wide.960.webp / wide.1440.webp, the before as a 16:9 still, and `rect`, the 9:16 crop's box in
* it (fractions x, y, w, h), centred on `focus`
* and src/lib/fx-pairs.generated.ts: { "<id>": { v, kind, rect? } }, v the content version every URL ends in (?v=).
*
@@ -41,6 +43,7 @@ const MANIFEST = path.join(ROOT, "src", "lib", "fx-pairs.generated.ts");
const SIZES = [
{ tag: "480", w: 480, h: 360, maxBytes: 40_000 },
{ tag: "960", w: 960, h: 720, maxBytes: 140_000 },
+ { tag: "1440", w: 1440, h: 1080, maxBytes: 300_000 },
];
const KINDS = ["pair", "matte", "depth", "loupe", "strip", "reframe"];
@@ -112,7 +115,8 @@ async function make(src) {
const b = await sharp(before).metadata();
const beforeBox = scaleBox(box, b.width, b.height);
const files = {};
- for (const size of SIZES) {
+ const hd = a.width >= 1400;
+ for (const size of SIZES.filter((z) => hd || z.tag !== "1440")) {
const B = await still(before, beforeBox, size);
const A = await still(after, box, size, { alpha: kind === "matte" });
files[`before.${size.tag}.webp`] = B.webp;
@@ -120,7 +124,7 @@ async function make(src) {
files[`after.${size.tag}.webp`] = A.webp;
files[`after.${size.tag}.avif`] = A.avif;
}
- const entry = { kind };
+ const entry = { kind, ...(hd && { hd: true }) };
if (kind === "loupe") {
// A square of the after at its own resolution (a quarter of its height), and the same square of the before enlarged.
const s = Math.round(a.height / 4);
@@ -154,7 +158,7 @@ async function make(src) {
const { width: W, height: H } = await sharp(before).metadata();
const wh = Math.min(H, Math.round((W * 9) / 16));
const wide = { left: 0, top: Math.round((H - wh) / 2), width: W, height: wh };
- for (const [tag, w, max] of [["480", 480, 40_000], ["960", 960, 140_000]]) {
+ for (const [tag, w, max] of [["480", 480, 40_000], ["960", 960, 140_000], ...(hd ? [["1440", 1440, 300_000]] : [])]) {
const h = Math.round((w * 9) / 16);
files[`wide.${tag}.webp`] = await fitting((q) => sharp(before).extract(wide).resize(w, h, { fit: "fill", kernel: "lanczos3" }).removeAlpha().webp({ quality: q }).toBuffer(), [82, 76, 70, 64], max);
}
@@ -176,16 +180,19 @@ function writeManifest(pairs) {
const sorted = Object.fromEntries(Object.keys(pairs).sort().map((k) => [k, pairs[k]]));
const head = `/**
* Fuobe FX's cover pairs, by FX item id (src/lib/fx-tools.ts): public/previews/fx/<id>/before.480.webp and after.480.webp
- * (480x360, the same framing, so a divider lines up), the same at 960x720 (.960.webp), and each as .avif. "matte": the
+ * (480x360, the same framing, so a divider lines up), the same at 960x720 (.960.webp) and, for an \`hd\` pair, 1440x1080
+ * (.1440.webp), and each as .avif. "matte": the
* after is a cut-out with alpha. "depth": the after is the depth pass. "loupe": also before.loupe.webp / after.loupe.webp
* (240x240; .loupe2x.webp 480x480), a 1:1 detail of the after and the before enlarged to it, at \`loupe\` (fractions
* x, y, w, h of the frame). "strip": also strip.webp, 6 frames of the output clip side by side, 480x360 each.
- * "reframe": also wide.480.webp / wide.960.webp (the before at 16:9), and \`rect\` is the 9:16 crop's box in it (fractions). Every URL ends in ?v=<v>. Generated by
+ * "reframe": also wide.480.webp / wide.960.webp / wide.1440.webp (the before at 16:9), and \`rect\` is the 9:16 crop's box in it (fractions). Every URL ends in ?v=<v>. Generated by
* scripts/gen-fx-pairs.mjs: run it again rather than editing.
*/
export interface FxPair {
v: string;
kind: "pair" | "matte" | "depth" | "loupe" | "strip" | "reframe";
+ /** It has 1440 px copies (its after is that sharp). */
+ hd?: boolean;
loupe?: [number, number, number, number];
frames?: number;
rect?: [number, number, number, number];
diff --git a/src/components/fx/fx-compare.tsx b/src/components/fx/fx-compare.tsx
index 96fda20b..a4fa4126 100644
--- a/src/components/fx/fx-compare.tsx
+++ b/src/components/fx/fx-compare.tsx
@@ -17,6 +17,7 @@ import {
nextShow,
posAt,
reframeVars,
+ restFor,
showPos,
stripFrames,
stripShift,
@@ -32,7 +33,8 @@ import { cn } from "@/lib/utils";
* still split with a hairline and tiny "Before" and "After" tags (fx-compare.css draws every state):
* pair, depth a mouse moves the divider; the after (a depth pass for depth) is cut there
* matte the same, the cut-out on a transparency checkerboard
- * loupe a lens under the mouse: the soft before detail on its left, the sharp after on its right
+ * loupe at rest the divider sits near the left (the sharp after fills the card); a lens under the mouse:
+ * the soft before detail on its left, the sharp after on its right
* reframe the wide still with the tall crop's box outlined; the outside dims under the mouse
* strip frame 1; under the mouse, the output's frames as a flipbook
* A finger's tap shows the after, the next the before (the card's name still opens the page). With reduced motion the
@@ -84,7 +86,8 @@ export function FxCompare({ view, sizes, eager, keys, className }: Props) {
const [armed, setArmed] = useState(false);
const [ready, setReady] = useState(false);
const loaded = useRef(0);
- const pos = useRef(FX_REST);
+ const rest = restFor(view);
+ const pos = useRef(rest);
const at = useRef<{ x: number; y: number } | null>(null);
const raf = useRef(0);
const pointer = useRef("mouse");
@@ -112,7 +115,7 @@ export function FxCompare({ view, sizes, eager, keys, className }: Props) {
showRef.current = show;
const el = ref.current;
if (!el) return;
- if (divides) setPos(showPos(show));
+ if (divides) setPos(showPos(show, rest));
if (kind === "loupe" && show === "after") {
const [x, y] = lensHome(view.loupe, el.clientWidth, el.clientHeight);
const [dx, dy] = loupePan(0.5, 0.5, LENS_DETAIL, LENS);
@@ -189,7 +192,7 @@ export function FxCompare({ view, sizes, eager, keys, className }: Props) {
raf.current = 0;
delete el.dataset.hover;
delete el.dataset.follow;
- if (divides) setPos(showPos(showRef.current));
+ if (divides) setPos(showPos(showRef.current, rest));
};
return (
@@ -207,7 +210,9 @@ export function FxCompare({ view, sizes, eager, keys, className }: Props) {
? (reframeVars(view.rect) as React.CSSProperties)
: kind === "strip"
? ({ "--fxc-frames": frames, "--fxc-last": `${stripShift(frames - 1, frames)}%` } as React.CSSProperties)
- : undefined
+ : rest !== FX_REST
+ ? ({ "--fxc-pos": `${rest}%` } as React.CSSProperties)
+ : undefined
}
onPointerEnter={onPointerEnter}
onPointerMove={onPointerMove}
diff --git a/src/lib/fx-compare.ts b/src/lib/fx-compare.ts
index 135ef643..bc12d596 100644
--- a/src/lib/fx-compare.ts
+++ b/src/lib/fx-compare.ts
@@ -18,6 +18,11 @@ export function fxView(id: string): FxView | undefined {
/** Where the divider rests: the before on the left 35 %, the after on the right 65 %. */
export const FX_REST = 35;
+/** An upscale's (a loupe card's) divider rests near the left, so the sharp after fills the card at a glance. */
+export const FX_REST_LOUPE = 12;
+
+/** Where a card's divider rests. */
+export const restFor = (v: Pick<FxView, "kind">) => (v.kind === "loupe" ? FX_REST_LOUPE : FX_REST);
/** How far one arrow key moves the divider (Shift: a bigger step). */
export const FX_STEP = 5;
@@ -56,7 +61,7 @@ export const followsPointer = (pointerType: string, reduced: boolean) => pointer
/** Whether a tap toggles the card instead of opening its page: a touch screen's finger or pen. */
export const tapToggles = (pointerType: string) => pointerType === "touch" || pointerType === "pen";
-/** A side's files: AVIF and WebP srcsets (480 and 960 px wide), and the 480 px WebP as the fallback src. */
+/** A side's files: AVIF and WebP srcsets (480 and 960 px wide, and 1440 for an `hd` pair), and the 480 px WebP as the fallback src. */
export interface FxSources {
avif: string;
webp: string;
@@ -66,16 +71,16 @@ export interface FxSources {
export function fxSources(v: FxView, side: "before" | "after"): FxSources {
const at = (f: string) => fxPairSrc(v.id, f)!;
return {
- avif: `${at(`${side}.480.avif`)} 480w, ${at(`${side}.960.avif`)} 960w`,
- webp: `${at(`${side}.480.webp`)} 480w, ${at(`${side}.960.webp`)} 960w`,
+ avif: `${at(`${side}.480.avif`)} 480w, ${at(`${side}.960.avif`)} 960w${v.hd ? `, ${at(`${side}.1440.avif`)} 1440w` : ""}`,
+ webp: `${at(`${side}.480.webp`)} 480w, ${at(`${side}.960.webp`)} 960w${v.hd ? `, ${at(`${side}.1440.webp`)} 1440w` : ""}`,
src: at(`${side}.480.webp`),
};
}
-/** Reframe's 16:9 still (WebP only). */
+/** Reframe's 16:9 still (WebP only), 480 and 960 px wide (and 1440 for an `hd` pair). */
export function fxWideSources(v: FxView): { webp: string; src: string } {
const at = (f: string) => fxPairSrc(v.id, f)!;
- return { webp: `${at("wide.480.webp")} 480w, ${at("wide.960.webp")} 960w`, src: at("wide.480.webp") };
+ return { webp: `${at("wide.480.webp")} 480w, ${at("wide.960.webp")} 960w${v.hd ? `, ${at("wide.1440.webp")} 1440w` : ""}`, src: at("wide.480.webp") };
}
/** The loupe's detail of one side: 240 px, and 480 px for a 2x screen. */
diff --git a/src/lib/fx-pairs.generated.ts b/src/lib/fx-pairs.generated.ts
index 66de5ad7..99050fcc 100644
--- a/src/lib/fx-pairs.generated.ts
+++ b/src/lib/fx-pairs.generated.ts
@@ -1,15 +1,18 @@
/**
* Fuobe FX's cover pairs, by FX item id (src/lib/fx-tools.ts): public/previews/fx/<id>/before.480.webp and after.480.webp
- * (480x360, the same framing, so a divider lines up), the same at 960x720 (.960.webp), and each as .avif. "matte": the
+ * (480x360, the same framing, so a divider lines up), the same at 960x720 (.960.webp) and, for an `hd` pair, 1440x1080
+ * (.1440.webp), and each as .avif. "matte": the
* after is a cut-out with alpha. "depth": the after is the depth pass. "loupe": also before.loupe.webp / after.loupe.webp
* (240x240; .loupe2x.webp 480x480), a 1:1 detail of the after and the before enlarged to it, at `loupe` (fractions
* x, y, w, h of the frame). "strip": also strip.webp, 6 frames of the output clip side by side, 480x360 each.
- * "reframe": also wide.480.webp / wide.960.webp (the before at 16:9), and `rect` is the 9:16 crop's box in it (fractions). Every URL ends in ?v=<v>. Generated by
+ * "reframe": also wide.480.webp / wide.960.webp / wide.1440.webp (the before at 16:9), and `rect` is the 9:16 crop's box in it (fractions). Every URL ends in ?v=<v>. Generated by
* scripts/gen-fx-pairs.mjs: run it again rather than editing.
*/
export interface FxPair {
v: string;
kind: "pair" | "matte" | "depth" | "loupe" | "strip" | "reframe";
+ /** It has 1440 px copies (its after is that sharp). */
+ hd?: boolean;
loupe?: [number, number, number, number];
frames?: number;
rect?: [number, number, number, number];
@@ -20,12 +23,14 @@ export const fxPairSrc = (id: string, file: string): string | undefined => (FX_P
export const FX_PAIRS: Record<string, FxPair> = {
"character-swap": {
- "v": "e2648ec4",
- "kind": "pair"
+ "v": "c02eceb8",
+ "kind": "pair",
+ "hd": true
},
"color-grade": {
- "v": "f55c5b88",
- "kind": "pair"
+ "v": "e2e25c40",
+ "kind": "pair",
+ "hd": true
},
"extend": {
"v": "e88b8655",
@@ -53,8 +58,9 @@ export const FX_PAIRS: Record<string, FxPair> = {
"kind": "pair"
},
"genjutsu-restyle": {
- "v": "b00f8501",
- "kind": "pair"
+ "v": "5f2dcae3",
+ "kind": "pair",
+ "hd": true
},
"genjutsu-swap": {
"v": "912009fd",
@@ -69,12 +75,14 @@ export const FX_PAIRS: Record<string, FxPair> = {
"kind": "pair"
},
"inpaint": {
- "v": "79b01434",
- "kind": "pair"
+ "v": "5ef847bd",
+ "kind": "pair",
+ "hd": true
},
"layers": {
- "v": "7b66fc4b",
- "kind": "pair"
+ "v": "cc85037f",
+ "kind": "pair",
+ "hd": true
},
"motion-control": {
"v": "4480ab9c",
@@ -91,8 +99,9 @@ export const FX_PAIRS: Record<string, FxPair> = {
]
},
"upscale": {
- "v": "68c98961",
+ "v": "6584800e",
"kind": "loupe",
+ "hd": true,
"loupe": [
0.4063,
0.2752,
@@ -106,8 +115,9 @@ export const FX_PAIRS: Record<string, FxPair> = {
"frames": 6
},
"upscale-video": {
- "v": "ff95b494",
+ "v": "30a163e1",
"kind": "loupe",
+ "hd": true,
"loupe": [
0.4361,
0.2046,
@@ -128,19 +138,23 @@ export const FX_PAIRS: Record<string, FxPair> = {
"kind": "depth"
},
"video-tools-green-screen": {
- "v": "60977b78",
- "kind": "pair"
+ "v": "21727225",
+ "kind": "pair",
+ "hd": true
},
"video-tools-relight": {
- "v": "fa351a1c",
- "kind": "pair"
+ "v": "25c52e2f",
+ "kind": "pair",
+ "hd": true
},
"video-tools-remove-object": {
- "v": "52883535",
- "kind": "pair"
+ "v": "0e5e3f52",
+ "kind": "pair",
+ "hd": true
},
"video-tools-restore": {
- "v": "6ba2f23f",
- "kind": "pair"
+ "v": "1d375f1d",
+ "kind": "pair",
+ "hd": true
}
};
diff --git a/tests/fx-compare.test.ts b/tests/fx-compare.test.ts
index 2e5ebd11..80d0dfa1 100644
--- a/tests/fx-compare.test.ts
+++ b/tests/fx-compare.test.ts
@@ -3,6 +3,7 @@ import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import {
FX_REST,
+ FX_REST_LOUPE,
followsPointer,
fxLoupeSources,
fxSources,
@@ -22,6 +23,7 @@ import {
showPos,
stripShift,
tapToggles,
+ restFor,
} from "@/lib/fx-compare";
import { FX_PAIRS } from "@/lib/fx-pairs.generated";
import { fxSections, fxShowcase } from "@/lib/area-showcase";
@@ -41,14 +43,16 @@ describe("Fuobe FX before/after cards: the pairs", () => {
expect(fxView("no-such-item")).toBeUndefined();
});
- it("points every source at a file that exists, versioned, AVIF and WebP at both sizes", () => {
+ it("points every source at a file that exists, versioned, AVIF and WebP at every size", () => {
for (const id of Object.keys(FX_PAIRS)) {
const v = fxView(id)!;
const urls: string[] = [];
if (v.kind === "reframe") urls.push(...fxWideSources(v).webp.split(", ").map((s) => s.split(" ")[0]));
for (const side of ["before", "after"] as const) {
const s = fxSources(v, side);
- expect(s.avif, id).toMatch(/\.480\.avif\?v=[0-9a-f]{8} 480w, .+\.960\.avif\?v=[0-9a-f]{8} 960w$/);
+ // A sharp source (hd) also has a 1440 px copy, for a large card on a 2x screen.
+ const sizes = v.hd ? /\.480\.avif\?v=[0-9a-f]{8} 480w, .+\.960\.avif\?v=[0-9a-f]{8} 960w, .+\.1440\.avif\?v=[0-9a-f]{8} 1440w$/ : /\.480\.avif\?v=[0-9a-f]{8} 480w, .+\.960\.avif\?v=[0-9a-f]{8} 960w$/;
+ expect(s.avif, id).toMatch(sizes);
urls.push(s.src, ...[s.avif, s.webp].flatMap((x) => x.split(", ").map((y) => y.split(" ")[0])));
if (v.kind === "loupe") urls.push(...fxLoupeSources(v, side).srcSet.split(", ").map((y) => y.split(" ")[0]));
}
@@ -78,6 +82,11 @@ describe("Fuobe FX before/after cards: the divider", () => {
it("rests at a 35/65 split, and a tap shows all of one side, then the other", () => {
expect(FX_REST).toBe(35);
expect(showPos("rest")).toBe(35);
+ // An upscale's card rests on its sharp side: the divider near the left.
+ expect(restFor({ kind: "loupe" })).toBe(FX_REST_LOUPE);
+ expect(FX_REST_LOUPE).toBeLessThan(20);
+ expect(restFor({ kind: "pair" })).toBe(FX_REST);
+ expect(showPos("rest", restFor({ kind: "loupe" }))).toBe(FX_REST_LOUPE);
expect(nextShow("rest")).toBe("after");
expect(nextShow("after")).toBe("before");
expect(nextShow("before")).toBe("after");
diff --git a/tests/fx-pairs.test.ts b/tests/fx-pairs.test.ts
index a03f4db1..ac528b7a 100644
--- a/tests/fx-pairs.test.ts
+++ b/tests/fx-pairs.test.ts
@@ -13,7 +13,7 @@ describe("Fuobe FX cover pairs", () => {
for (const [id, pair] of Object.entries(FX_PAIRS)) {
expect(items.has(id), id).toBe(true);
expect(pair.v, id).toMatch(/^[0-9a-f]{8}$/);
- for (const [size, w, h, max] of [["480", 480, 360, 40_000], ["960", 960, 720, 140_000]] as const) {
+ for (const [size, w, h, max] of [["480", 480, 360, 40_000], ["960", 960, 720, 140_000], ...(pair.hd ? ([["1440", 1440, 1080, 300_000]] as const) : [])] as const) {
for (const side of ["before", "after"])
for (const ext of ["webp", "avif"]) {
const file = path.join(dir(id), `${side}.${size}.${ext}`);