Images loaded from palletized TGA files lack alpha channels #110437
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#110437
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows 11 Home
Graphics card: Intel ARC A750 8GB
Blender Version
Broken: 3.6.1 and 4.0.0
2ed108cb84
Worked: None tested
Short description of error
When a palletized TGA file is loaded as an image, any transparent pixels come through as opaque black.
This does not occur for unpalletized TGA files; they come through transparent as expected.
An example of the same file in both palletized and unpalletized formats is attached. The files look identical in Aseprite.
Exact steps for others to reproduce the error
This can additionally be confirmed by looking at the histogram, with the unpalletized file having a small spike at 0% for alpha while the palletized file is flat until 100%.
Can confirm that palletized tga doesn't load with alpha. (But not sure if pallet+alpha is to spec)
imagemagick
andgeeqie
is loading both correctlyGIMP
failed to load palletized tga completely, doesn't show correct image.Here's what GIMP shows on palletized tga when alpha channel is manually removed after loading:
This is a problematic texture, with an unfortunate history.
The texture itself declares in its header (byte offset 17) that it contains 0 bits of alpha [1]. Our imaging library is now respecting this data and so no alpha channel is created for it.
Previous blender versions: Older Blender versions were "broken" in 2 ways actually, but by accident, allowed things to work in some cases. First this texture will not work in Cycles if the alpha channel is expected. Eevee and the Image Editor work by accident. You can see that it's actually being loaded as RGB with no Alpha [4] but by luck happens to work due to a quirk of the old image loading code.
What about GIMP: The nightly 2.99.x versions will load it because they have a workaround to bypass the broken textures :( [2]
What about Krita: Krita actually refuses to load the palettized image entirely and issues an error [3]
Others? : Other software, like current released versions of GIMP, are affected too (see Yiming's comment above)
[1] Truevision TGA, File Format Specification, Version 2.0 as PDF, Page 8: https://www.loc.gov/preservation/digital/formats/fdd/fdd000180.shtml
[2] Gimp workaround: https://gitlab.gnome.org/GNOME/gimp/-/blob/master/plug-ins/common/file-tga.c#L550
[3] Krita error logs
[4] Blender incorrect format from 3.3.8 LTS
So it might be an Aseprite bug that it is creating this file at all? Tonight I’ll experiment with changing the header byte called out see what happens. If palletized TGA cannot have an alpha channel I’ll get a bug raised on the Aseprite side. Cheers.
Which version of GIMP is that? Testing with 2.10.32, both files loaded with the alpha channel preserved.
Ah, so, reading the spec, it seems there is supposed to be an "extension area" following the image data which should contain the following field:
I'll raise this as a bug on the Aseprite side, thanks.
I tried using GIMP 2.10.18 which failed to load it properly but 2.99.16 succeeds as they have their own workaround in place.
The part of the spec is probably this one -- in the main TGA file header:
Bits 3-0 in the provided file are 0.
That said, I think even after this is fixed our image library will have issues doing the proper thing. I'll have to work with the upstream project to fix the issue (which can take some time) but having a "valid" set of image files is a good first step for Aseprite to address first.