Skip to content

Fix writing alpha bits flag in .tga

Freya Lupen requested to merge freyalupen/krita:freyalupen/tga-alphabit into master

Correctly flag TGA as 8-bit alpha (0x8) instead of 0x4 (4-bit). Krita assumes the alpha bitdepth as 8 on reading, but other programs do not; GIMP returns an error, and KImageFormats masks the alpha to the given bitdepth, resulting in unintended rendering.

BUG:464484

This code is also present in KImageFormats. It probably should be fixed there, too?

Test Plan

  1. Save a .tga containing semitransparency in Krita.
  2. Open the file in GIMP and check that it loads without error.
  3. Open the file in a program using KImageFormats for TGA support (Gwenview for example, and probably Krita's Recent Document thumbnails?), and check that the semitransparency renders as expected.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Amy spark

Merge request reports