jimp-dev/jimp

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

Open

#1,019 opened on 2021年6月5日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)JavaScript (13,218 stars) (785 forks)batch import
bughelp wanted

説明

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

コントリビューターガイド

Bug? Blend mode "SCREEN" does not work on transparent pixels · jimp-dev/jimp#1019 | Good First Issue