OSCommerce Product Manager

OSCommerce Product Manager for Windows

FS#273 - Watermark uploaded images.

Attached to Project: OSCommerce Product Manager
Opened by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 21 September 2005, 14:15 GMT-5
Last edited by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 25 July 2007, 05:37 GMT-5
Task Type New feature
Category Backend / Core
Status Closed
Assigned To Mario A. Valdez-Ramirez (mvaldez)
Operating System All
Severity Medium
Priority Low
Reported Version any
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Create the option to select a graphic (PNG, GIF, TIFF, etc) to blend with all uploaded images, to watermark all images. Some store users use to add their logo to their images or their URL.
This task depends upon

Closed by  Mario A. Valdez-Ramirez (mvaldez)
Wednesday, 25 July 2007, 05:37 GMT-5
Reason for closing:  
Comment by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 25 July 2007, 05:04 GMT-5
Closing as Implemented.
Comment by Mario A. Valdez-Ramirez (mvaldez) - Wednesday, 25 July 2007, 05:37 GMT-5
The new Watermarking feature works like this:

If enabled, the application will try to load the watermark image, create an automatic transparency mask (an alpha mask), and then combine the watermark with the image that will be uploaded. This is done even if resizing is disabled.

The automatic alpha mask generation is done as follow:
Copy the watermark image.
Convert the copy to a grayscale image (8-bits).
Convert the greyscale copy to 24-bits.
Alpha-blend the grayscale image to a white background image, according to the given blending level configured in the application.
Extract the red channel from the grayscale image.
Invert (negativize) the extracted channel. This is the transparency mask.
Copy the negative greyscale extracted channel to the alpha channel of the original color watermark image.

This is needed so the watermark does not need to have its own alpha channel mask, so the user can use any image he/she wants.

Those steps create a transparency mask that allow the darkest parts of the watermark image to be more visible, regardless of its color, and the whiter parts to be more transparent. The blending correction is done by adjusting the darkness of the alpha mask (when blending it with the white background).