[GH-ISSUE #769] [Issue]: Character Library cards distort cropped avatars (square crop stretched to 4:3) #370

Closed
opened 2026-10-20 17:28:06 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (May 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/769

Originally assigned to: @Romuromylus on GitHub.

Summary

In the Character Library, the image area on each card (and the hero image in the detail panel) renders in a 4:3 aspect ratio. The avatar crop format saves a square region in source pixels, and the renderer stretches that square crop to fill the 4:3 container, leaving cropped characters visibly squished vertically / stretched horizontally.

Expected behavior

When an avatar has a saved crop, the cropped region should display undistorted in the Character Library card and detail panel — the same proportions the user saw when setting the crop in AvatarCropWidget.

Actual behavior

Square crops render distorted by the container's aspect ratio (4:3). Faces look wide / compressed vertically. Verifiable in source: getAvatarCropStyle (packages/client/src/lib/utils.ts:143) sizes the <img> to (cw/srcWidth × ch/srcHeight) with object-fit: fill. Combined with a non-square container, this stretches a square-in-source-pixels crop by exactly the container aspect ratio. A related bypass already exists in packages/client/src/components/chat/ChatMessage.tsx:1179 (rectangleSafeCropStyle) for RP rectangle avatars, but the Character Library has no such bypass.

Steps to reproduce

  1. Open or create a character with a saved avatar crop (use the crop widget to pick a square region).
  2. Open the Character Library.
  3. Observe the card thumbnail above the name — the cropped portion is visibly stretched horizontally.
  4. Click the card to open the detail panel — the hero image at the top is distorted the same way.

Environment

  • Marinara Engine version: 1.5.9
  • Install type: source / docker
  • OS + version: any
  • Browser or app shell: any (Chromium verified)

Logs, screenshots, or video

Reported by a Discord user with screenshots showing the squish, plus a verified CSS workaround:

```css
.sm:aspect-[4/3] {
aspect-ratio: 1/1;
}
.aspect-[4/3] {
aspect-ratio: 1/1;
}
```

(Applied via custom theme, fixed the visual distortion.)

Additional context

Affected source lines:

  • `packages/client/src/components/characters/CharacterLibraryView.tsx:106` — detail panel hero image container
  • `packages/client/src/components/characters/CharacterLibraryView.tsx:429` — grid card image container

Either fix the rendering math in `getAvatarCropStyle` (more invasive — ~30 consumers, can retire `rectangleSafeCropStyle`) or change just the Character Library containers from `aspect-[4/3]` to `aspect-square` so the saved square crop renders undistorted in the area where the bug is reported. The latter mirrors the user-verified CSS workaround.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (May 12, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/769 Originally assigned to: @Romuromylus on GitHub. ## Summary In the Character Library, the image area on each card (and the hero image in the detail panel) renders in a 4:3 aspect ratio. The avatar crop format saves a square region in source pixels, and the renderer stretches that square crop to fill the 4:3 container, leaving cropped characters visibly squished vertically / stretched horizontally. ## Expected behavior When an avatar has a saved crop, the cropped region should display undistorted in the Character Library card and detail panel — the same proportions the user saw when setting the crop in `AvatarCropWidget`. ## Actual behavior Square crops render distorted by the container's aspect ratio (4:3). Faces look wide / compressed vertically. Verifiable in source: `getAvatarCropStyle` (`packages/client/src/lib/utils.ts:143`) sizes the `<img>` to `(cw/srcWidth × ch/srcHeight)` with `object-fit: fill`. Combined with a non-square container, this stretches a square-in-source-pixels crop by exactly the container aspect ratio. A related bypass already exists in `packages/client/src/components/chat/ChatMessage.tsx:1179` (`rectangleSafeCropStyle`) for RP rectangle avatars, but the Character Library has no such bypass. ## Steps to reproduce 1. Open or create a character with a saved avatar crop (use the crop widget to pick a square region). 2. Open the Character Library. 3. Observe the card thumbnail above the name — the cropped portion is visibly stretched horizontally. 4. Click the card to open the detail panel — the hero image at the top is distorted the same way. ## Environment - Marinara Engine version: 1.5.9 - Install type: source / docker - OS + version: any - Browser or app shell: any (Chromium verified) ## Logs, screenshots, or video Reported by a Discord user with screenshots showing the squish, plus a verified CSS workaround: \`\`\`css .sm\:aspect-\[4\/3\] { aspect-ratio: 1/1; } .aspect-\[4\/3\] { aspect-ratio: 1/1; } \`\`\` (Applied via custom theme, fixed the visual distortion.) ## Additional context Affected source lines: - \`packages/client/src/components/characters/CharacterLibraryView.tsx:106\` — detail panel hero image container - \`packages/client/src/components/characters/CharacterLibraryView.tsx:429\` — grid card image container Either fix the rendering math in \`getAvatarCropStyle\` (more invasive — ~30 consumers, can retire \`rectangleSafeCropStyle\`) or change just the Character Library containers from \`aspect-[4/3]\` to \`aspect-square\` so the saved square crop renders undistorted in the area where the bug is reported. The latter mirrors the user-verified CSS workaround. ## Template check - [ ] I DID NOT read this template and provide the requested details.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#370
No description provided.