Jump to content

Photo: Export transparent PNG with auto palette broken


Recommended Posts

If I want to export a layer with transparency in Photo 2.5.5 as PNG with palette "auto", then the preview (exported file) just shows an empty picture.
PNG without palette and not automatic palettes seems to work.
I remember that some minor version before had already a similar bug. Was it introduced again?

image.png

title-foreground.png

image.png

Link to comment
Share on other sites

Welcome to the Affinity forums.

Do you really mean to be exporting a 32-bit (RGB-32) PNG file? More commonly RGB-8 or RGB-16 would be used, and I'm not sure it makes sense to be using RGB-32 and Palettized. For RGB-8 and 16 Palettized works fine for me.

You can change the Pixel Format in your Export Settings:

image.png.cab159d9c3fc5515d0b87fcbc3a988c8.png

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

Thanks, didn't noticed it (I assume I tested the different presets). 

But sadly it's also not working with any of the other pixel formats (including keeping document format).
Weird that it works for you, maybe something wrong with my picture? I attached it now to this post in the afphoto format.
What I also noticed: picture is 403 pixels high in the main view, but on the export dialog it changes to 404 pixels...

image.png

example.afphoto

Link to comment
Share on other sites

45 minutes ago, dPRogerWilco said:

What I also noticed: picture is 403 pixels high in the main view, but on the export dialog it changes to 404 pixels...

Your document height is actually 403.334501px, and since exported images must use whole pixels, it's rounded up.

image.png.d10fed2ddef97906aa382e2155392f6c.png

48 minutes ago, dPRogerWilco said:

Weird that it works for you, maybe something wrong with my picture? I attached it now to this post in the afphoto format.

Thanks for sharing the image. Your Curves Adjustment is what causes the problem with the Palletization, but I have no idea why. Hiding that layer allows the Preview to work with Palletization specified.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

Palettized option seem to need matting enabled, or an document with fully opaque content. Then it works.

Algorithm seems to use alpha value of transparent pixels which are the majority in you file.

 

if you merge visible, or deactivate curves adjustment layer, palettised export works. So workaround is simple. But probably a bug.

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

Thanks both for your help.

Interesting, that a picture can have non natural numbers as dimension.

Back to my export issue:
I use the curve adjustment layer to manual control the "binary" mask, because indexed PNG doesn't have semi transparency and the export dialog does not have a adjustment for this.
I tried now your suggestions and merged the layers. I also exported the file as non indexed PNG (see attachment) to be sure that nothing is left of my layers and half pixels. But still, export as indexed PNG with palette does not work for me. :(

image.png

example.png

Link to comment
Share on other sites

you curves adjustment does not fully mitigate the issues. When I compare the rasterized layer against the source by blend mode difference, it shows minor differences.

I get better results (no differences) when using a levels adjustment, set both black and white level to 50%.

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

2 hours ago, dPRogerWilco said:

But still, export as indexed PNG with palette does not work for me

You curve is not correct. the nodes must be exactly 0.5 / 0.0 and 0.5 / 1.0.

Both nodes are sligthly off, leading to alpha of 254 instead of 255.

If you set the nodes by numeric input to the exact position, it will work.

Thos minor details matter.

 

Screenshot 2024-09-28 140320.png

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

To summarize, i don't think we have a bug.

Like in some other functions (e.g. stack), alpha channel is treated "binary". only alpha = 1 gets exported, all smaller values are treated as 0.

The wrong export was caused by a curves adjustment which lead to alpha = 254 / 255, thus treated as zero at export.

The info panel will show the issue of partial alpha.

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

Thanks a lot for your help, that was the reason it was not working... such a minimal mistake. :) 

It probably only sees exact 1.0 as opaque, because it wouldn't know what background color it should use to calculate the RGB result otherwise. But from usability point of view a threshold of 0.5 (or even selectable) would be better.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.