jimp-dev / jimp-dev/jimp

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

Open
#1,019 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
TypeScript
Stars
14.7k
Forks
777
PR merge metrics
No merged PRs in 30d

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.