web: EXPORT offers a size, and a bigger one is upscaled in the browser

The server still never sees a photo, so the model has to run in the page.
Real-ESRGAN x4v3 ships as a 4.9MB ONNX in public/models and is loaded
lazily on the first export that actually needs it; the wasm runtime is
copied next to CanvasKit at build time and stays lazily fetched, cached
for 30 days. Vite is told onnxruntime-web is external-wasm so no 28MB
asset lands in the bundle.

UNCHANGED keeps the old path and the tier cap; 2K/4K/custom upscale only
when the request is larger than the photo being edited, otherwise they
resize down. Guests keep UNCHANGED and 2K. Tiling is 256px with an 8px
overlap, so memory follows the target size rather than four times it.
This commit is contained in:
2026-09-22 09:40:18 +07:00
parent f9a40a9e1c
commit c0c99a9672
13 changed files with 17553 additions and 22 deletions
+13
View File
@@ -18,6 +18,7 @@ export const en: Dict = {
'act.reset': 'RESET',
'act.export': 'EXPORT',
'act.exporting': 'Exporting…',
'act.upscaling': 'Upscaling the photo {done}/{total}…',
'act.cancel': 'Cancel',
'drop.title': 'Drag & drop a photo here',
@@ -174,6 +175,18 @@ export const en: Dict = {
'clear.discard': 'CLEAR WITHOUT SAVING',
'clear.cancel': 'CANCEL',
// Export size. A target over the photo's own longest edge is upscaled on the
// device by the model (engine/superRes), so the file carries the pixels asked for.
'export.title': 'Export photo',
'export.hint':
"Longest edge of the photo on the stage: {px}px. Anything bigger is upscaled on this device.",
'export.same': 'EXPORT UNCHANGED',
'export.2k': 'EXPORT 2K (2048px)',
'export.4k': 'EXPORT 4K (4096px)',
'export.customLabel': 'Longest edge (px)',
'export.custom': 'EXPORT',
'export.cap': 'Guest exports are capped at {px}px.',
'photo.uploading': 'UPLOADING…',
'photos.title': 'My photos',
+13
View File
@@ -25,6 +25,7 @@ export const vi = {
'act.reset': 'ĐẶT LẠI',
'act.export': 'XUẤT ẢNH',
'act.exporting': 'Đang xuất…',
'act.upscaling': 'Đang phóng to ảnh {done}/{total}…',
'act.cancel': 'Huỷ',
'drop.title': 'Kéo & thả ảnh vào đây',
@@ -182,6 +183,18 @@ export const vi = {
'clear.discard': 'XOÁ KHÔNG LƯU',
'clear.cancel': 'HUỶ',
// Xuất ảnh: kích thước đích. Mức lớn hơn cạnh dài nhất của ảnh đang sửa được
// model phóng to ngay trên máy (engine/superRes), nên tệp ra đúng số pixel đã hỏi.
'export.title': 'Xuất ảnh',
'export.hint':
'Cạnh dài nhất của ảnh đang sửa: {px}px. Mức lớn hơn sẽ được phóng to ngay trên máy này.',
'export.same': 'XUẤT KHÔNG ĐỔI',
'export.2k': 'XUẤT 2K (2048px)',
'export.4k': 'XUẤT 4K (4096px)',
'export.customLabel': 'Cạnh dài nhất (px)',
'export.custom': 'XUẤT',
'export.cap': 'Bản khách giới hạn ở {px}px.',
'photo.uploading': 'ĐANG TẢI…',
'photos.title': 'Ảnh của tôi',