Skip to content

psd: Fix alpha blending

PSD files are saved with as alpha premultiplied. The problem is that alpha refers to white instead of black so it requires transformation formulas. Then, to conver PS premultiplied to QImage premultiplied you have to use the following formula:

  • V = Alpha + Vps - Max (C, M, Y, K, R, G, B, Gray, L* components)
  • V = Vps + (Alpha - Max + 1) / 2 (a*, b* components)

Where Max is the maximum value depending on the image depth and Vps is the valued read from the file.

Edited by Mirco Miranda

Merge request reports

Loading