Skip to content

Conversation

Sola-ris
Copy link
Contributor

@Sola-ris Sola-ris commented Sep 24, 2025

Summary

Add support for rendering .pdn thumbnails.
Fixes #1147

.pdn files have an XML header that contains the thumbnail as a base64 encoded .png file.
The file layout is the following:

  • 4 byte magic number (PDN3)
  • 24-bit little-endian int specifying the header's length
  • The XML header
  • The actual image data which we don't care about

The header itself looks like this:

<pdnImage width="800" height="600" layers="1" savedWithVersion="5.109.9343.2610">
    <custom>
        <thumb png="base64 string" />
    </custom>
</pdnImage>

Sources for the file format

Before

before

After

after

File used for testing

pdn.zip (The actual file is archived since GitHub doesn't allow uploading .pdn files)

Tasks Completed

  • Platforms Tested:
    • Windows x86
    • Windows ARM
    • macOS x86
    • macOS ARM
    • Linux x86
    • Linux ARM
  • Tested For:
    • Basic functionality
    • PyInstaller executable

@Sola-ris Sola-ris changed the title feat: render .pdn thumbnails. feat: render .pdn thumbnails. Sep 24, 2025
@TrigamDev
Copy link
Contributor

.pdn files have an XML header that contains the thumbnail as a base64 encoded .png file.

Well that's convenient

@TrigamDev
Copy link
Contributor

Transparent backgrounds appear to be interpreted as pure black in the thumbnail preview, but not in the sidebar preview.

@Sola-ris
Copy link
Contributor Author

I'll take a look

@Sola-ris
Copy link
Contributor Author

Regular PNGs have a background added, if they're in RGBA. I've given the thumbnail the same treatment
with-background

@TrigamDev
Copy link
Contributor

I haven't noticed any other images in my library with a transparent background having a background added. And I'd argue that if it is a behavior in other file types, it should be fixed as it's very unintuitive and unwanted behavior.

@Sola-ris
Copy link
Contributor Author

Happens for regular images and exr image.
I have no opinion on it, but I don't think it's something that should be changed as part of this issue.

@TrigamDev
Copy link
Contributor

TrigamDev commented Sep 26, 2025

Yeah I agree that it should be a separate issue..
Thanks for your work on the thumbnail rendering btw, didn't expect someone to start working on these so quickly.

@Sola-ris
Copy link
Contributor Author

You're welcome :D

@CyanVoxel CyanVoxel added Type: UI/UX User interface and/or user experience Status: Review Needed A review of this is needed Thumbs/Previews File thumbnails or previews labels Sep 28, 2025
@CyanVoxel CyanVoxel added this to the Alpha v9.5.7 milestone Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Needed A review of this is needed Thumbs/Previews File thumbnails or previews Type: UI/UX User interface and/or user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Thumbnail preview for pdn files
3 participants