[GH-ISSUE #3964] [Issue]: Add Set as avatar action to gallery images #2141

Closed
opened 2026-10-21 05:45:43 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @SpicyMarinara on GitHub (Jul 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3964

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Allow users to set an existing character or persona gallery image as its avatar directly. This removes the need to download the image and re-upload it through the avatar picker.

Expected behavior

Each gallery image should offer a "Set as avatar" action. Selecting it should copy the image to the avatars directory, update the owning character or persona's avatarPath, retain the original gallery image, and reset avatarCrop or open the existing crop editor.

Actual behavior

Gallery images cannot be applied directly as avatars. Users must download the desired image and then re-upload it through the avatar picker; the avatar generator cannot reuse an existing gallery image.

Steps to reproduce

  1. Open a character or persona that has an image in its gallery.
  2. Open the gallery image actions.
  3. Observe that there is no "Set as avatar" action.
  4. Download the image and re-upload it through the avatar picker to use it as the avatar.

Environment

  • Marinara Engine version: 2.3.4
  • Install type: Not provided
  • OS + version: Not provided
  • Browser or app shell: Not provided

Logs, screenshots, or video

No logs, screenshots, or video provided.

Additional context

The action should support both characters and personas and target the owner of the gallery where it was invoked, including in multi-character chats. Suggested implementation: add a gallery action and endpoint that validates the destination filename, copies the gallery file into DATA_DIR/avatars/, updates avatarPath, and refreshes the character or persona. Existing gallery routes, avatar filename validation, avatar upload/generator logic, avatarCrop handling, and the SillyTavern bulk import copy behavior may be reusable. The current alternatives are download/re-upload or generating a new portrait. A maintainer responded that the feature would be added.

Discord thread: FR Add a "Set as avatar" action on gallery images (promote a generated chat image to a ch
Discord thread link: https://discord.com/channels/1417099416812392641/1529683903256854698
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (3 messages)
[2026-07-23T02:57:42.689Z] ChrisDay: ### Summary
Let a user set an existing **gallery image** as a character's or persona's avatar directly, instead of downloading it and re-uploading it through the avatar picker.

### Problem / motivation
Since 2.2.1 (#3538), images generated in a chat auto-copy into the depicted character/persona's gallery. But there's no way to turn one of those images into the character's **avatar** without leaving the app — you download the gallery image to disk, then re-upload it via the avatar uploader. The two native avatar entry points don't cover this case:

- **Upload a file** — requires the download → re-upload round-trip.
- **Avatar generator** — image-gens a *new* portrait; it can't reuse a selfie or illustration that already emerged in a scene and that you specifically liked.

The common case: an image comes out of a scene looking exactly right for the character, and you want it to *be* the avatar. Today that's a manual export/import; it should be one click from the place the image already lives.

### Proposed solution
Add a **"Set as avatar"** action to each image in a character/persona gallery.


### Scope / details
- Works for both **characters and personas** (both have galleries and avatars).
- **Copy, don't move** — the image stays in the gallery.
- **Multi-character chats need no disambiguation:** the image lives in one specific character's gallery, so the target is whatever gallery the action is invoked from.
- **Crop:** setting a new avatar should reset `avatarCrop` (or open the existing crop editor); that UI already exists in the character editor.
- Reuse existing avatar filename validation; no new upload surface introduced.


### Alternatives considered
- **Download + re-upload** — the current workaround; the friction this removes.
- **Avatar generator** — produces a new portrait, can't reuse an existing liked image.
[Discord message: https://discord.com/channels/1417099416812392641/1529683903256854698/1529683903256854698]

[2026-07-23T02:57:58.401Z] ChrisDay: - **Server:** copy the gallery image file into `DATA_DIR/avatars/` under a validated filename and update the character/persona's `avatarPath`. This is essentially the copy the SillyTavern bulk importer already performs (`st-bulk.importer.ts` → `copyFile(p.path, join(AVATAR_DIR, destName))`), followed by the same `avatarPath` write the avatar upload/generator paths already do. Reuse the existing avatars filename validation (`isValidFilename`) and the existing "apply this image as the avatar" terminal step that the generator flow already uses.
- **Client:** surface a "Set as avatar" control on the gallery image alongside the existing gallery actions; on click, call the new endpoint and refresh the character.

### Why it's a small, natural fit now
Every building block already ships in 2.3.4:
- Gallery images are first-class objects with their own routes (`gallery.routes.ts`) and, since 2.2.1, are auto-populated from chats.
- The avatars store, upload endpoint, and filename validation exist (`avatars.routes.ts`, `DATA_DIR/avatars/`, `readAvatarDataUrl`).
- Characters and personas already carry `avatarPath` and `extensions.avatarCrop`.
- Applying an image as the avatar is already a solved terminal step for generated avatars.

So this is mostly wiring an existing copy + an existing avatar-write behind a gallery button.

I had this functionality as an extension....
[Discord message: https://discord.com/channels/1417099416812392641/1529683903256854698/1529683969157763172]

[2026-07-23T07:13:12.827Z] Marinara: Adding, no worries.
[Discord message: https://discord.com/channels/1417099416812392641/1529683903256854698/1529748202515861645]

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Jul 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3964 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Allow users to set an existing character or persona gallery image as its avatar directly. This removes the need to download the image and re-upload it through the avatar picker. ## Expected behavior Each gallery image should offer a "Set as avatar" action. Selecting it should copy the image to the avatars directory, update the owning character or persona's avatarPath, retain the original gallery image, and reset avatarCrop or open the existing crop editor. ## Actual behavior Gallery images cannot be applied directly as avatars. Users must download the desired image and then re-upload it through the avatar picker; the avatar generator cannot reuse an existing gallery image. ## Steps to reproduce 1. Open a character or persona that has an image in its gallery. 2. Open the gallery image actions. 3. Observe that there is no "Set as avatar" action. 4. Download the image and re-upload it through the avatar picker to use it as the avatar. ## Environment - Marinara Engine version: 2.3.4 - Install type: Not provided - OS + version: Not provided - Browser or app shell: Not provided ## Logs, screenshots, or video No logs, screenshots, or video provided. ## Additional context The action should support both characters and personas and target the owner of the gallery where it was invoked, including in multi-character chats. Suggested implementation: add a gallery action and endpoint that validates the destination filename, copies the gallery file into DATA_DIR/avatars/, updates avatarPath, and refreshes the character or persona. Existing gallery routes, avatar filename validation, avatar upload/generator logic, avatarCrop handling, and the SillyTavern bulk import copy behavior may be reusable. The current alternatives are download/re-upload or generating a new portrait. A maintainer responded that the feature would be added. Discord thread: FR Add a "Set as avatar" action on gallery images (promote a generated chat image to a ch Discord thread link: https://discord.com/channels/1417099416812392641/1529683903256854698 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (3 messages)</summary> ```text [2026-07-23T02:57:42.689Z] ChrisDay: ### Summary Let a user set an existing **gallery image** as a character's or persona's avatar directly, instead of downloading it and re-uploading it through the avatar picker. ### Problem / motivation Since 2.2.1 (#3538), images generated in a chat auto-copy into the depicted character/persona's gallery. But there's no way to turn one of those images into the character's **avatar** without leaving the app — you download the gallery image to disk, then re-upload it via the avatar uploader. The two native avatar entry points don't cover this case: - **Upload a file** — requires the download → re-upload round-trip. - **Avatar generator** — image-gens a *new* portrait; it can't reuse a selfie or illustration that already emerged in a scene and that you specifically liked. The common case: an image comes out of a scene looking exactly right for the character, and you want it to *be* the avatar. Today that's a manual export/import; it should be one click from the place the image already lives. ### Proposed solution Add a **"Set as avatar"** action to each image in a character/persona gallery. ### Scope / details - Works for both **characters and personas** (both have galleries and avatars). - **Copy, don't move** — the image stays in the gallery. - **Multi-character chats need no disambiguation:** the image lives in one specific character's gallery, so the target is whatever gallery the action is invoked from. - **Crop:** setting a new avatar should reset `avatarCrop` (or open the existing crop editor); that UI already exists in the character editor. - Reuse existing avatar filename validation; no new upload surface introduced. ### Alternatives considered - **Download + re-upload** — the current workaround; the friction this removes. - **Avatar generator** — produces a new portrait, can't reuse an existing liked image. [Discord message: https://discord.com/channels/1417099416812392641/1529683903256854698/1529683903256854698] [2026-07-23T02:57:58.401Z] ChrisDay: - **Server:** copy the gallery image file into `DATA_DIR/avatars/` under a validated filename and update the character/persona's `avatarPath`. This is essentially the copy the SillyTavern bulk importer already performs (`st-bulk.importer.ts` → `copyFile(p.path, join(AVATAR_DIR, destName))`), followed by the same `avatarPath` write the avatar upload/generator paths already do. Reuse the existing avatars filename validation (`isValidFilename`) and the existing "apply this image as the avatar" terminal step that the generator flow already uses. - **Client:** surface a "Set as avatar" control on the gallery image alongside the existing gallery actions; on click, call the new endpoint and refresh the character. ### Why it's a small, natural fit now Every building block already ships in 2.3.4: - Gallery images are first-class objects with their own routes (`gallery.routes.ts`) and, since 2.2.1, are auto-populated from chats. - The avatars store, upload endpoint, and filename validation exist (`avatars.routes.ts`, `DATA_DIR/avatars/`, `readAvatarDataUrl`). - Characters and personas already carry `avatarPath` and `extensions.avatarCrop`. - Applying an image as the avatar is already a solved terminal step for generated avatars. So this is mostly wiring an existing copy + an existing avatar-write behind a gallery button. I had this functionality as an extension.... [Discord message: https://discord.com/channels/1417099416812392641/1529683903256854698/1529683969157763172] [2026-07-23T07:13:12.827Z] Marinara: Adding, no worries. [Discord message: https://discord.com/channels/1417099416812392641/1529683903256854698/1529748202515861645] ``` </details> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:45:43 +07:00
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#2141
No description provided.