jimp-dev/jimp

Bug? Blend mode "SCREEN" does not work on transparent pixels

Open

#1 019 ouverte le 5 juin 2021

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)JavaScript (785 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (13 218 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Expected Behavior

I create a new Jimp with all pixels set to 0xFFFFFF00, then composite another image with all pixels set to 0x00000000 over it using Jimp.BLEND_SCREEN, then set the result to opaque, like so:

var pic = new Jimp(25, 25, 0xFFFFFF00).composite(new Jimp(25, 25, 0x00000000), 0, 0, {mode:Jimp.BLEND_SCREEN}).opaque();

This should yield an image with all pixels at 0xFFFFFFFF.

Current Behavior

The result is an image with everything set to 0x000000FF;

Failure Information (for bugs)

It looks like the algorithm simply nulls everything when the destination is at alpha 0? This makes it impossible, for example, to composite a blurred version of a picture that has transparency over itself using screen blending in order to create a halo of light - it will look like a drop shadow instead!

This also happens with ADD, by the way.

Steps to Reproduce

See above for code.

Context

  • Jimp Version: 0.16.1 in a browser
  • Operating System: win
  • Node version: n/a

Guide contributeur