jimp-dev/jimp

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

オープン

#1,019 opened on 2021/06/05

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (785 件のフォーク)batch import
bughelp wanted

Repository metrics

Stars
 (13,218 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

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