Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/site/results/carousel-1.avif
Binary file not shown.
Binary file added public/site/results/carousel-1.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/carousel-2.avif
Binary file not shown.
Binary file added public/site/results/carousel-2.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/carousel-3.avif
Binary file not shown.
Binary file added public/site/results/carousel-3.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/carousel-source.avif
Binary file not shown.
Binary file added public/site/results/carousel-source.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/cutout-after.avif
Binary file not shown.
Binary file added public/site/results/cutout-after.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/cutout-before.avif
Binary file not shown.
Binary file added public/site/results/cutout-before.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/develop-after.avif
Binary file not shown.
Binary file added public/site/results/develop-after.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/develop-before.avif
Binary file not shown.
Binary file added public/site/results/develop-before.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/remove-after.avif
Binary file not shown.
Binary file added public/site/results/remove-after.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/remove-before.avif
Binary file not shown.
Binary file added public/site/results/remove-before.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/upscale-after.avif
Binary file not shown.
Binary file added public/site/results/upscale-after.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/site/results/upscale-before.avif
Binary file not shown.
Binary file added public/site/results/upscale-before.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
417 changes: 417 additions & 0 deletions scripts/build-result-stills.mjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions scripts/register-ts.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { register } from 'node:module'

register('./ts-resolve-hook.mjs', new URL('./', import.meta.url).href)
35 changes: 35 additions & 0 deletions scripts/result-stills.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { test } from 'node:test'
import sharp from 'sharp'

/** Files the home and tool pages point at. Dimensions are the ones written into src/site/results.ts. */
const STILLS = {
'develop-before': [1200, 801],
'develop-after': [1200, 801],
'cutout-before': [731, 877],
'cutout-after': [731, 877],
'remove-before': [840, 672],
'remove-after': [840, 672],
'upscale-before': [512, 384],
'upscale-after': [512, 384],
'carousel-source': [960, 640],
'carousel-1': [540, 675],
'carousel-2': [540, 675],
'carousel-3': [540, 675],
}

test('result stills exist as webp and avif at the documented size', async () => {
for (const [name, [width, height]] of Object.entries(STILLS)) {
for (const ext of ['webp', 'avif']) {
const path = `public/site/results/${name}.${ext}`
const bytes = await readFile(path)
assert.ok(bytes.length > 500, path)
const meta = await sharp(bytes).metadata()
assert.equal(meta.width, width, path)
assert.equal(meta.height, height, path)
}
}
const cutout = await sharp('public/site/results/cutout-after.webp').stats()
assert.ok(cutout.channels[3].min < 10, 'cutout after keeps a transparent background')
})
14 changes: 14 additions & 0 deletions scripts/ts-resolve-hook.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Resolve extensionless imports in src/*.ts when the result stills script
* loads the editor's own modules under node --experimental-strip-types.
*/
export async function resolve(specifier, context, nextResolve) {
if ((specifier.startsWith('.') || specifier.startsWith('/')) && !/\.(?:js|mjs|cjs|ts|json|node|wasm)$/.test(specifier)) {
try {
return await nextResolve(`${specifier}.ts`, context)
} catch {
return nextResolve(`${specifier}.js`, context)
}
}
return nextResolve(specifier, context)
}
2 changes: 1 addition & 1 deletion src/lib/cutout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const SUBJECT_MARGIN = 12
* foliage): keep the solid regions of subject size, plus a soft margin
* around them, and clear everything else.
*/
function cleanCutout(alpha: Uint8ClampedArray, n: number): Uint8ClampedArray<ArrayBuffer> {
export function cleanCutout(alpha: Uint8ClampedArray, n: number): Uint8ClampedArray<ArrayBuffer> {
const labels = new Int32Array(n * n).fill(-1)
const sizes: number[] = []
const stack = new Int32Array(n * n)
Expand Down
39 changes: 39 additions & 0 deletions src/site/components/BeforeAfter.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
/**
* Side-by-side stills, same pattern as the free-presets pack: a figure, a
* caption under it, several of them in a row.
*/
import type { Still } from '../results'

interface Props {
shots: Still[]
caption?: string
}

const { shots, caption } = Astro.props
---

<div class="ba">
<div class="ba__frames">
{
shots.map((shot) => (
<figure class:list={['ba__shot', shot.transparent && 'ba__shot--alpha']}>
<picture>
<source srcset={shot.avif} type="image/avif" />
<img
src={shot.src}
width={shot.width}
height={shot.height}
alt={shot.alt}
loading={shot.priority ? 'eager' : 'lazy'}
decoding={shot.priority ? 'sync' : 'async'}
fetchpriority={shot.priority ? 'high' : undefined}
/>
</picture>
<figcaption>{shot.label}</figcaption>
</figure>
))
}
</div>
{caption && <p class="ba__note">{caption}</p>}
</div>
16 changes: 16 additions & 0 deletions src/site/landing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ export const landing = {
h1: 'The open-source photo editor that stays on your device',
lead: 'Apply your own presets, Lightroom XMP files and .cube LUTs across a whole shoot, then export an Instagram-ready carousel. It all runs in the browser. Nothing is uploaded.',
secondary: 'How it works',
cta: 'Open the editor — no sign-up',
promise: 'No uploads. It runs in this tab.',
heroCaption: 'twelve-apostles.jpg after exposure, colour and clarity. The before is with the examples below.',
heroAlt: 'Twelve Apostles sea stacks after exposure and colour adjustments in Lightframes',
results: {
h2: 'Before and after, from the sample photos',
lead: 'These are the sample photos shipped with the editor, processed with the same code. Nothing here is a mockup.',
},
facts: ['Free and open source', 'Presets, XMP and LUTs', 'Nothing uploaded'],
video: {
label: 'Lightframes in action: editing, presets, batch export, AI tools and collages',
Expand Down Expand Up @@ -68,6 +76,14 @@ export const landing = {
h1: 'El editor de fotos open source que se queda en tu dispositivo',
lead: 'Aplica tus presets, archivos XMP de Lightroom y LUTs .cube a toda una sesión y exporta un carrusel listo para Instagram. Todo ocurre en el navegador. No se sube nada.',
secondary: 'Cómo funciona',
cta: 'Abrir el editor — sin registro',
promise: 'Sin subir archivos. Se ejecuta en esta pestaña.',
heroCaption: 'twelve-apostles.jpg tras exposición, color y claridad. El antes está con los ejemplos de abajo.',
heroAlt: 'Los stacks de los Twelve Apostles tras ajustar exposición y color en Lightframes',
results: {
h2: 'Antes y después, con las fotos de ejemplo',
lead: 'Son las fotos de ejemplo que trae el editor, procesadas con el mismo código. No hay maquetas.',
},
facts: ['Gratis y de código abierto', 'Presets, XMP y LUTs', 'Sin subir nada'],
video: {
label: 'Lightframes en acción: edición, presets, exportación por lotes, herramientas de IA y collages',
Expand Down
236 changes: 236 additions & 0 deletions src/site/results.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
import type { Lang } from './i18n'

export interface Still {
/** WebP fallback. */
src: string
avif: string
width: number
height: number
alt: string
label: string
/** Draw a checkerboard behind the pixels so a transparent background reads as empty. */
transparent?: boolean
/** Above-the-fold result. Preload the AVIF separately; this only sets fetch priority. */
priority?: boolean
}

/**
* Stills in public/site/results/, produced by scripts/build-result-stills.mjs
* from public/samples/. The captions say what was actually done.
*/

const SRC = '/site/results'

function still(
name: string,
width: number,
height: number,
alt: string,
label: string,
extra: Partial<Still> = {},
): Still {
return {
src: `${SRC}/${name}.webp`,
avif: `${SRC}/${name}.avif`,
width,
height,
alt,
label,
...extra,
}
}

export interface ResultExample {
/** Tool `key`, when the example belongs on that tool page. */
toolKey: string
href: string
title: string
caption: string
shots: Still[]
}

const PATHS: Record<Lang, Record<string, string>> = {
en: {
'raw-to-jpg': '/tools/raw-to-jpg',
'background-remover': '/tools/background-remover',
'remove-objects': '/tools/remove-objects-from-photos',
upscaler: '/tools/ai-image-upscaler',
carousel: '/tools/instagram-carousel-maker',
},
es: {
'raw-to-jpg': '/es/herramientas/convertir-raw-a-jpg',
'background-remover': '/es/herramientas/quitar-fondo-foto',
'remove-objects': '/es/herramientas/borrar-objetos-foto',
upscaler: '/es/herramientas/ampliar-foto-ia',
carousel: '/es/herramientas/carrusel-instagram',
},
}

export function resultExamples(lang: Lang): ResultExample[] {
const en = lang === 'en'
const before = en ? 'Before' : 'Antes'
const after = en ? 'After' : 'Después'
const href = PATHS[lang]
return [
{
toolKey: 'raw-to-jpg',
href: href['raw-to-jpg'],
title: en ? 'Develop, then export' : 'Revelar y exportar',
caption: en
? 'Before is public/samples/twelve-apostles.jpg, the flat JPEG shipped with the editor (developed flat from the author’s RAW; that RAW file is not in the repo). After is the same JPEG through the editor’s develop pipeline: exposure +0.85, contrast +26, highlights −65, shadows +85, whites +25, blacks −20, temperature +22, vibrance +55, saturation +8, clarity +32, dehaze +30.'
: 'Antes es public/samples/twelve-apostles.jpg, el JPEG plano que trae el editor (revelado plano a partir del RAW del autor; ese RAW no está en el repositorio). Después es el mismo JPEG pasado por el revelado del editor: exposición +0,85, contraste +26, altas luces −65, sombras +85, blancos +25, negros −20, temperatura +22, intensidad +55, saturación +8, claridad +32, dehaze +30.',
shots: [
still(
'develop-before',
1200,
801,
en
? 'Twelve Apostles sea stacks, the flat sample JPEG before adjustments'
: 'Los Twelve Apostles, el JPEG de ejemplo plano, antes de los ajustes',
before,
),
still(
'develop-after',
1200,
801,
en
? 'The same Twelve Apostles photo after exposure, colour and clarity in Lightframes'
: 'La misma foto de los Twelve Apostles tras exposición, color y claridad en Lightframes',
after,
),
],
},
{
toolKey: 'background-remover',
href: href['background-remover'],
title: en ? 'Background removed' : 'Fondo quitado',
caption: en
? 'A crop of public/samples/pagoda.jpg. After uses the IS-Net subject mask shipped in public/models, cleaned with the editor’s speck filter, and keeps the background transparent. The checkerboard is not part of the photo. The crop is the tower; the same mask also keeps some leaves lower in the frame.'
: 'Un recorte de public/samples/pagoda.jpg. Después usa la máscara de sujeto IS-Net que va en public/models, limpia con el filtro de motas del editor, y deja el fondo transparente. El damero no forma parte de la foto. El recorte es la torre; la misma máscara también conserva algunas hojas más abajo.',
shots: [
still(
'cutout-before',
731,
877,
en ? 'Pagoda tower against a cloudy sky, before background removal' : 'Torre de la pagoda contra un cielo nublado, antes de quitar el fondo',
before,
),
still(
'cutout-after',
731,
877,
en
? 'The same pagoda crop with the sky removed and a transparent background'
: 'El mismo recorte de la pagoda con el cielo quitado y el fondo transparente',
after,
{ transparent: true },
),
],
},
{
toolKey: 'remove-objects',
href: href['remove-objects'],
title: en ? 'Person healed out' : 'Persona eliminada con el parche',
caption: en
? 'A crop of public/samples/pagoda.jpg. After is one Heal spot on the person standing on the gravel: brush radius about 53 px on the long edge, copying gravel from 110 px left and 70 px up, then blended by the editor’s Heal code. The brush also reaches the second person, who stands against the eaves, so that edge stays soft. An inpaint of these figures filled the hole with leaves, so this still is the Heal result.'
: 'Un recorte de public/samples/pagoda.jpg. Después es un parche Heal sobre la persona que está en la grava: radio de unos 53 px en el lado largo, copiando grava desde 110 px a la izquierda y 70 px arriba, y mezclado con el código Heal del editor. El pincel también alcanza a la segunda persona, que está contra el alero, así que ese borde queda suave. Un relleno por IA de estas figuras cubrió el hueco con hojas, así que este ejemplo es el resultado de Heal.',
shots: [
still(
'remove-before',
840,
672,
en
? 'Two people on the gravel path under the pagoda eaves, before healing'
: 'Dos personas en el camino de grava bajo el alero de la pagoda, antes del parche',
before,
),
still(
'remove-after',
840,
672,
en
? 'The same crop after Heal copies nearby gravel over the person on the path'
: 'El mismo recorte después de que Heal copia la grava cercana sobre la persona del camino',
after,
),
],
},
{
toolKey: 'upscaler',
href: href.upscaler,
title: en ? '2× upscale' : 'Ampliación 2×',
caption: en
? 'A 600×450 crop of the pagoda roof in public/samples/pagoda.jpg, scaled down to 256 px on the long edge. Before enlarges that small crop 2× with a smooth resize. After is Real-ESRGAN (the model in public/models) at 2× on the same pixels, mixed with 20% of the smooth resize, which is what export does. It is not detail that was never in the file.'
: 'Un recorte de 600×450 del tejado de la pagoda en public/samples/pagoda.jpg, reducido a 256 px en el lado largo. Antes amplía ese recorte pequeño 2× con un reescalado suave. Después es Real-ESRGAN (el modelo de public/models) a 2× sobre los mismos píxeles, mezclado con un 20% del reescalado suave, que es lo que hace la exportación. No es detalle que no estuviera en el archivo.',
shots: [
still(
'upscale-before',
512,
384,
en
? 'Pagoda roof crop enlarged 2× with a smooth resize from a 256 px source'
: 'Recorte del tejado de la pagoda ampliado 2× con un reescalado suave desde 256 px',
en ? 'Smooth resize' : 'Reescalado suave',
),
still(
'upscale-after',
512,
384,
en
? 'The same roof crop enlarged 2× with Real-ESRGAN and a 20% smooth-resize mix'
: 'El mismo recorte del tejado ampliado 2× con Real-ESRGAN y un 20% de reescalado suave',
en ? 'Real-ESRGAN 2×' : 'Real-ESRGAN 2×',
),
],
},
{
toolKey: 'carousel',
href: href.carousel,
title: en ? 'Three seamless slides' : 'Tres diapositivas continuas',
caption: en
? 'public/samples/twelve-apostles.jpg in the Panorama layout: one photo across three 4:5 slides, cover-fit, painted by the editor’s carousel painter. Each slide is 540×675, half of the 1080×1350 export, so the crop is the export crop.'
: 'public/samples/twelve-apostles.jpg en la disposición Panorama: una foto a lo largo de tres diapositivas 4:5, en cover, pintadas con el pintor de carrusel del editor. Cada diapositiva es de 540×675, la mitad de la exportación a 1080×1350, así que el recorte es el de la exportación.',
shots: [
still(
'carousel-source',
960,
640,
en ? 'The full Twelve Apostles sample, before it is split into slides' : 'La foto completa de ejemplo de los Twelve Apostles, antes de dividirla',
en ? 'Source' : 'Origen',
),
still(
'carousel-1',
540,
675,
en ? 'Carousel slide 1 of 3, the left of the Twelve Apostles panorama' : 'Diapositiva 1 de 3 del carrusel, la izquierda de la panorámica',
en ? 'Slide 1' : 'Diapositiva 1',
),
still(
'carousel-2',
540,
675,
en ? 'Carousel slide 2 of 3, the middle of the Twelve Apostles panorama' : 'Diapositiva 2 de 3 del carrusel, el centro de la panorámica',
en ? 'Slide 2' : 'Diapositiva 2',
),
still(
'carousel-3',
540,
675,
en ? 'Carousel slide 3 of 3, the right of the Twelve Apostles panorama' : 'Diapositiva 3 de 3 del carrusel, la derecha de la panorámica',
en ? 'Slide 3' : 'Diapositiva 3',
),
],
},
]
}

export function exampleForTool(toolKey: string, lang: Lang): ResultExample | undefined {
return resultExamples(lang).find((example) => example.toolKey === toolKey)
}

/** The adjusted sample used as the hero result. Same file as the develop “after”. */
export function heroResult(lang: Lang): Still {
const example = exampleForTool('raw-to-jpg', lang)!
const after = example.shots[1]!
return { ...after, label: lang === 'es' ? 'Resultado' : 'Result', priority: true }
}
Loading
Loading