[GH-ISSUE #673] [Issue]: New-format avatar crops stretch in RP rectangle and glued-panel avatars #319

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

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

Originally assigned to: @Romuromylus on GitHub.

Summary

Avatars rendered in Roleplay-mode rectangle layouts (the "Small Rectangles" compact style and the "Glued Side Panel") apply the new source-rectangle avatar crop format directly, which stretches the cropped region to fit non-square aspect ratios. This affects both character avatars in the assistant bubble and user-persona avatars in the user bubble.

Expected behavior

The new-format crop should center the user's chosen focal point inside the rectangle without distortion. Legacy {zoom, offsetX, offsetY} crops should continue to work as before (they compose with object-cover as a CSS transform).

Actual behavior

PR #671's getAvatarCropStyle for new-format crops sets the <img> to position: absolute with width: 100/srcWidth% and height: 100/srcHeight%, then uses object-fit: fill. That math assumes the parent has the same aspect ratio as the crop (which the editor enforces to be square in source pixels).

For the RP rectangular sites:

  • rpg-avatar-panel-tail / rpg-avatar-panel-media (glued side panel) — parent is taller than wide (or wider than tall when the message is short).
  • compactAvatarFrameClass when useCompactRectangleAvatar (small rectangles style) — parent is roughly 2.75rem × 3.5rem (taller than wide).

object-fit: fill on an <img> whose intrinsic aspect ratio differs from the parent's stretches it. Visible symptoms: glued panel shows a horizontally-squished face, small rectangles show a vertically-squished face, and short user-message panels (which render as wide rectangles) show only the top of the source (e.g. just the character's hair).

Steps to reproduce

  1. Open a roleplay character that has a new-format avatarCrop saved (square region of a non-square source image).
  2. In Appearance settings → Roleplay Avatars, choose "Small Rectangles" or "Glued Side Panel".
  3. Open the chat:
    • Small Rectangles: the side avatar tile shows a distorted/squished face.
    • Glued Side Panel: the panel tile shows the face stretched to the panel's aspect ratio.
  4. Send a short user message in Glued Side Panel mode where the user persona has a new-format crop — the user's avatar bubble renders as a wide rectangle showing only the top of the persona source (e.g. just the hair).

Environment

  • Marinara Engine version: post-#671 (upstream main 51dbd59 or ec317b7)
  • Install type: source / Docker
  • Browser: Chrome (Windows 11)

Logs, screenshots, or video

Reported by a Marinara user reproducing on a deployed instance. Symptoms vary based on message bubble height (panel adapts to the bubble) but the cause is the same: new-format crop math doesn't match non-square parent aspect ratios.

Additional context

The fix is straightforward: detect rectangular layout sites and, for new-format crops only, swap the absolute-positioned img sizing for object-position at the crop's center point. object-cover then fills the rectangle without distortion while still respecting the user's chosen focal point. Legacy crops pass through unchanged. Round/square frames (Small Circles compact style, Conversation Mode bubble) continue to use PR #661's original logic.

A follow-up PR with the patch is on the way.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (May 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/673 Originally assigned to: @Romuromylus on GitHub. ## Summary Avatars rendered in Roleplay-mode rectangle layouts (the "Small Rectangles" compact style and the "Glued Side Panel") apply the new source-rectangle avatar crop format directly, which stretches the cropped region to fit non-square aspect ratios. This affects both character avatars in the assistant bubble and user-persona avatars in the user bubble. ## Expected behavior The new-format crop should center the user's chosen focal point inside the rectangle without distortion. Legacy `{zoom, offsetX, offsetY}` crops should continue to work as before (they compose with `object-cover` as a CSS transform). ## Actual behavior PR #671's `getAvatarCropStyle` for new-format crops sets the `<img>` to `position: absolute` with `width: 100/srcWidth%` and `height: 100/srcHeight%`, then uses `object-fit: fill`. That math assumes the parent has the same aspect ratio as the crop (which the editor enforces to be square in source pixels). For the RP rectangular sites: - **`rpg-avatar-panel-tail` / `rpg-avatar-panel-media`** (glued side panel) — parent is taller than wide (or wider than tall when the message is short). - **`compactAvatarFrameClass` when `useCompactRectangleAvatar`** (small rectangles style) — parent is roughly `2.75rem × 3.5rem` (taller than wide). `object-fit: fill` on an `<img>` whose intrinsic aspect ratio differs from the parent's stretches it. Visible symptoms: glued panel shows a horizontally-squished face, small rectangles show a vertically-squished face, and short user-message panels (which render as wide rectangles) show only the top of the source (e.g. just the character's hair). ## Steps to reproduce 1. Open a roleplay character that has a new-format `avatarCrop` saved (square region of a non-square source image). 2. In Appearance settings → Roleplay Avatars, choose "Small Rectangles" or "Glued Side Panel". 3. Open the chat: - Small Rectangles: the side avatar tile shows a distorted/squished face. - Glued Side Panel: the panel tile shows the face stretched to the panel's aspect ratio. 4. Send a short user message in Glued Side Panel mode where the user persona has a new-format crop — the user's avatar bubble renders as a wide rectangle showing only the top of the persona source (e.g. just the hair). ## Environment - Marinara Engine version: post-#671 (upstream main `51dbd59` or `ec317b7`) - Install type: source / Docker - Browser: Chrome (Windows 11) ## Logs, screenshots, or video Reported by a Marinara user reproducing on a deployed instance. Symptoms vary based on message bubble height (panel adapts to the bubble) but the cause is the same: new-format crop math doesn't match non-square parent aspect ratios. ## Additional context The fix is straightforward: detect rectangular layout sites and, for new-format crops only, swap the absolute-positioned img sizing for `object-position` at the crop's center point. `object-cover` then fills the rectangle without distortion while still respecting the user's chosen focal point. Legacy crops pass through unchanged. Round/square frames (Small Circles compact style, Conversation Mode bubble) continue to use PR #661's original logic. A follow-up PR with the patch is on the way. ## 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#319
No description provided.