Issue Feature Closed

#60806Gifbuilder: Allow image-mask-functionality without specifying a mask

Stefan Neufeind 08/05/14, 18:35 updated 10/03/26, 07:27

Description

Currently you need to specify both an bgImg (the one to overlay) as well as a mask that masks which parts should be overlayed. That mask is converted to a grayscale-image.

If you for example use a png with transparency as bgImg you are free to use a mask that instructs to use “all” pixels with full opacity. When the mask is applied the included transparency of the png still has an effect.

So when using a bgImg which has an alpha-channel itself or if you want to apply a simple “stamp” onto your image (square-image, no transparency at all) then it would make sense to be able to leave out the mask-parameter completely.

For basics how to use/test with bgImg and mask for example see #59392.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 4

  1. Georg Ringer commented and changed status New Closed <span data-processor="relativetime" data-value="2026-10-03T07:27:21+00:00" > 10/03/26, 07:27 </span>

    I checked this against current main, and the mask is no longer needed for either use case described here.

    If an IMAGE object has no mask, GIFBUILDER copies the image onto the canvas with GD’s alpha blending:

    • A PNG with its own alpha channel is overlaid using that transparency. Fully transparent parts leave the background visible, and semi-transparent parts are blended.
    • An image without transparency is placed fully opaque, which is the “stamp” use case.
    lib.image = IMAGE
    lib.image.file = GIFBUILDER
    lib.image.file {
      XY = [10.w],[10.h]
      10 = IMAGE
      10.file = fileadmin/photo.jpg
      20 = IMAGE
      20.file = fileadmin/stamp-with-alpha.png
      20.offset = 20,20
    }

    I verified this with a functional test: a 30×10 PNG with an opaque, a half-transparent (alpha 64) and a fully transparent area was placed on a red canvas without mask. The results were blue for the opaque area, a blend of about (127,0,128) for the half-transparent area, and red for the fully transparent area.

    mask is only needed if an additional grayscale mask should be applied.