Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

add poker/tarot card aspect ratios and use them as per-kind deck defaults

[._.]/ Adam Eivy0969f1b0205a
diff --git a/client/src/lib/imageGenResolutions.js b/client/src/lib/imageGenResolutions.js
index 8652c9c7ad..1a1f5df7e3 100644
--- a/client/src/lib/imageGenResolutions.js
+++ b/client/src/lib/imageGenResolutions.js
@@ -36,6 +36,17 @@ export const RESOLUTIONS = [
{ label: '1280×1972 (comic page — draft)', w: 1280, h: 1972, compatible: ['codex'] },
{ label: '1920×2951 (comic page — hi-res, margin)', w: 1920, h: 2951, compatible: ['codex'] },
{ label: '1988×3056 (comic page — hi-res, full bleed)', w: 1988, h: 3056, compatible: ['codex'] },
+ // Poker/tarot card trims at true physical ratio (2.5"×3.5" = 5:7 and
+ // 2.75"×4.75" respectively), sized to a 300dpi print resolution and a 2x
+ // hi-res doubling. Distinct from the Decks feature's DECK_CARD_SIZE
+ // (deckTemplates.js, a rounded 2:3 render frame shared by both card kinds)
+ // — these are for a standalone card-shaped image outside the deck workflow.
+ // Codex-only: the ratios are too specialty for the local runners' trained
+ // aspect windows.
+ { label: '750×1050 (poker card, 2.5:3.5)', w: 750, h: 1050, compatible: ['codex'] },
+ { label: '1500×2100 (poker card, 2.5:3.5 hi-res)', w: 1500, h: 2100, compatible: ['codex'] },
+ { label: '825×1425 (tarot card, 2.75:4.75)', w: 825, h: 1425, compatible: ['codex'] },
+ { label: '1650×2850 (tarot card, 2.75:4.75 hi-res)', w: 1650, h: 2850, compatible: ['codex'] },
// gpt-image-2 final-render presets: hard ceiling is each edge ≤ 3840 and
// total ≤ 8,294,400 pixels. All three below sit exactly at the pixel cap
// — pick aspect by shape. Codex-only because mflux/diffusers are too slow
diff --git a/server/lib/deckTemplates.js b/server/lib/deckTemplates.js
index 820732d80e..5d3f5011b2 100644
--- a/server/lib/deckTemplates.js
+++ b/server/lib/deckTemplates.js
@@ -23,11 +23,23 @@ export const DECK_KIND_LABELS = Object.freeze({
[DECK_KIND.TAROT]: 'Tarot',
});
-// 2:3 portrait — the aspect every deck kind renders at, and the same frame the
-// universe canon thumbnails already assume, so a card slots into the shared
-// `EntryThumbSlot` without cropping.
+// Fallback portrait size for an unrecognized deck kind (2:3, matching the
+// universe canon thumbnail convention `EntryThumbSlot` was built around).
+// Real decks use `DECK_CARD_SIZE_BY_KIND` below instead.
export const DECK_CARD_SIZE = Object.freeze({ width: 1024, height: 1536 });
+// Per-kind default card size, at each kind's true physical trim ratio rather
+// than the generic 2:3 fallback above — poker cards are 2.5"×3.5" (5:7),
+// tarot cards are 2.75"×4.75" (11:19). Both hold the same 1536 long edge as
+// the generic default so render cost/detail stays comparable; `EntryThumbSlot`
+// renders with `object-cover`, so the modest difference from 2:3 crops fine
+// rather than distorting. A deck's own `cardSize` (persisted per-deck, see
+// `services/decks.js`) always wins — this is only the value new decks mint.
+export const DECK_CARD_SIZE_BY_KIND = Object.freeze({
+ [DECK_KIND.PLAYING]: Object.freeze({ width: 1096, height: 1536 }),
+ [DECK_KIND.TAROT]: Object.freeze({ width: 888, height: 1536 }),
+});
+
// The one card every deck has that is not a face: the shared back design.
export const DECK_BACK_KEY = 'back';
diff --git a/server/services/decks.js b/server/services/decks.js
index 75b2967e6c..40ca0cfe2d 100644
--- a/server/services/decks.js
+++ b/server/services/decks.js
@@ -19,7 +19,7 @@ import { ServerError } from '../lib/errorHandler.js';
import { trimTo } from '../lib/textUtils.js';
import { sanitizeLlmRoutePin } from '../lib/llmRoutePin.js';
import { universeVisualStyleTokens } from '../lib/universeVisualStyle.js';
-import { DECK_CARD_SIZE, DEFAULT_LAYOUT_PROMPT, deckCardRoster, deckCompletion } from '../lib/deckTemplates.js';
+import { DECK_CARD_SIZE, DECK_CARD_SIZE_BY_KIND, DEFAULT_LAYOUT_PROMPT, deckCardRoster, deckCompletion } from '../lib/deckTemplates.js';
import { DECK_CARD_IMAGE_REFS_MAX, DECK_SAMPLES_MAX } from '../lib/deckValidation.js';
import { recordRenderPin } from '../lib/renderTargets.js';
@@ -46,7 +46,7 @@ const projectDeck = (row) => {
samples: Array.isArray(d.samples) ? d.samples : [],
imageMode: pin.mode,
imageModelId: pin.modelId,
- cardSize: d.cardSize?.width && d.cardSize?.height ? d.cardSize : { ...DECK_CARD_SIZE },
+ cardSize: d.cardSize?.width && d.cardSize?.height ? d.cardSize : { ...(DECK_CARD_SIZE_BY_KIND[row.kind] || DECK_CARD_SIZE) },
promptLlm: sanitizeLlmRoutePin(d.promptLlm),
createdAt: row.created_at,
updatedAt: row.updated_at,
@@ -179,7 +179,7 @@ export async function createDeck({ name, kind, description = '', universeId = nu
...seeded,
layoutPrompt: DEFAULT_LAYOUT_PROMPT[kind],
samples: [],
- cardSize: { ...DECK_CARD_SIZE },
+ cardSize: { ...(DECK_CARD_SIZE_BY_KIND[kind] || DECK_CARD_SIZE) },
};
const roster = deckCardRoster(kind);
await withTransaction(async (client) => {