
In Photopea scripting, Document.name is a display label and Document.source is an identifying source string. Changing the name shown on a tab does not, by itself, establish a different origin or save destination. Use the property that represents the relationship your integration actually needs.
Separate the human label from the source identifier
Photopea's scripting reference explicitly defines both properties as readable and writable. It describes source as initially being the URL for a server-loaded file or a local identifier for other files. It describes name as the document's displayed label and notes that changing it does not add a History step.
For a hypothetical review integration, an editor might want a friendly label such as Approved Poster while the application still needs to identify which uploaded document it is editing. Those two values serve different audiences. Replacing an internal identifier with the friendly wording can destroy information the integration intended to preserve.
Do not infer a permanent file rename from a changed tab label. Browser display state, source identity and a written storage entry are separate observations.
Read both properties before changing either
Photopea exposes the active document through app.activeDocument. In a reviewed script, inspect that document's name and source separately. Keep the origin identifier as data when only the displayed label is meant to change.
This guide does not run a script or supply a production integration. Any automation should first identify the active document it is about to inspect. If several tabs are open, a correct property access can still refer to the wrong document.
The portable filename guide covers actual file naming and paths. A script's display label should not be treated as proof that those filesystem names changed.
Verify the contract the script promises
For a proposed label-only test, use a disposable document and record both property values. Change only the intended display label, then inspect the tab and source value again. The documented absence of a History step for name changes means History is not the right evidence that the new label took effect.
If the job instead needs to save a new file or return data to an embedding application, inspect that separate API or storage operation explicitly. The scripting reference documents several output mechanisms; setting a name is not a substitute for executing the correct one.
Keep logs meaningful without overclaiming persistence
Record the relationship between the integration's document identifier and its visible label where needed. Do not claim that a tab label proves a delivered file exists or that another session will preserve every piece of the same runtime state.
The saved-file versus undo-history guide explains another persistence distinction. Here the narrower acceptance target is that a label change changes the intended label while source identity is handled deliberately, with no unintended assumption about storage routing.
Related tasks
- Why Does My Photoshop Batch Action Save Files Under the Same Name?
- Apply Data Set or Export Data Sets as Files? Preserve Your Photoshop Template
- Why Does My Artwork Package Work Here but Fail on the Recipient’s File Path?
Sources and scope
- Photopea - Scripts: Document.name changes the displayed label without history, while Document.source identifies a server URL or a local-source token.
Based on official Photopea documentation read on October 23, 2026 (Asia/Shanghai). Any exercises are proposed checks, not hands-on tests. No script is executed by this guide; verify reviewed automation in a disposable project.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Mak Cézar / Pexels, Pexels License. This is an illustrative source photograph, not an application screenshot or a generated test result.