AsepriteScripts icon indicating copy to clipboard operation
AsepriteScripts copied to clipboard

Exporting Slices Corrupts RGB Values for Zero-Alpha Pixels

Open nnevatie opened this issue 1 year ago • 3 comments

Describe the bug Using the script to export slices causes the edgemost pixels outside the sprite's non-zero alpha to have corrupted RGB values. This is an issue when applying premultiplied alpha in rendering the exported slices.

To Reproduce

  1. Download the sprite with slices here: https://drive.google.com/file/d/1VL9wc6WL6vdYmgr4vBl40FI3NwAyiDZQ/view?usp=sharing
  2. Export the slices of the sprite manually.
  3. Export the slices of the sprite by using the script export_slices.
  4. Observe the RGB values of the two versions, near the visible edges of the exported slices.
  5. Observe the manually exported slices correctly having zero RGB (0, 0, 0) for zero alpha.
  6. Observe the scripted exports having non-zero RGB for the same pixels.

Expected behavior The scripted export should be identical to the manual export in terms of RGB values for the pixels.

Screenshots

System Information:

  • Windows 11
  • Aseprite version v1.3.7-x64
  • export_slices
  • Script commit: 2424a1f005cb7734ba6321c89e29b57f8d228716

Additional context

nnevatie avatar Jul 18 '24 08:07 nnevatie

This is an issue when applying premultiplied alpha in rendering the exported slices.

Premultiplied alpha is precisely the technique that remedies this issue. Did you mean to say bilinear interpolation?

Either way this appears to be outside of the control of the script, which just says "save this area of the image to a file" from where Aseprite takes over.

Zyl9393 avatar Sep 03 '24 13:09 Zyl9393

This is an issue when applying premultiplied alpha in rendering the exported slices.

Premultiplied alpha is precisely the technique that remedies this issue. Did you mean to say bilinear interpolation?

Either way this appears to be outside of the control of the script, which just says "save this area of the image to a file" from where Aseprite takes over.

Yes, you're correct. I was able to workaround the issue but modifying the Lua files locally - I'll check if I still have the modified files around, in case they're useful. I think they had to do with the resizing done in the script.

nnevatie avatar Sep 03 '24 14:09 nnevatie

This looks like an issue with the Aseprite export API. Can you confirm if it still happens in the latest Aseprite version? If it does, please create a PR.

PKGaspi avatar Oct 21 '25 10:10 PKGaspi