Using ImGearRasterProcessing class methods allows you to apply a watermark to an image. A digital watermark is any auxiliary data embedded into an image used for subsequent identification. For example, stamping a raster page as "DRAFT" or "CONFIDENTIAL" imparts meaning beyond any text or drawings present on that image.
The ImGearRasterProcessing.BlendWithAlpha() method can be used to place one raster page with an alpha channel over another raster page.
The use of an alpha channel is limited to raster pages with RGB or Grayscale color space only.
Apply a watermark to a page by doing the following:
A watermark raster page can be created with fixed text using ImageGear.ART methods. Annotation functionality in ImageGear provides different types of graphic objects like “Direct Text”, “Text”, “Rich Text” and others that can be printed at a fixed position and size on a page regardless of the dimensions of the printed page. To apply an annotation to the raster page, use the ImGearART.BurnIn() method.
In addition, the watermark page may be loaded from an appropriate image file that allows storing images with alpha channel.
Before blending the watermark page to the image, you can change the size of the watermark using the ImGearProcessing.Resize() method. The ImGearRasterProcessing.BlendWithAlpha() method works only with images that have the same color components, therefore, before the applying the watermark to the page, adjust the bit depth using the ImGearRasterProcessing.ChangeChannelDepths() method, if necessary.
To apply the watermark to the page, use the ImGearRasterProcessing.BlendWithAlpha() method.
You can use the ImageGear.ART namespace methods to create a text watermark. The ART namespace provides a set of methods for working with annotations. Annotations are the graphic elements that can be applied to the main page of a document. ImageGear provides a wide array of annotation marks that can be used for reviewing or updating document pages with new graphic elements.
The following example illustrates how a text based watermark page can be created using a "Text" annotation.
Loading the watermark from a file is performed in order to load the image from a file and is not discussed here. For additional information about loading images see the Loading topic.
The following example illustrates how to adjust the size and channel depths of the image using ImGearProcessing methods. The size of the watermark is adjusted to ¾ of the width or height of the image, depending on which is smaller. Then adjusting the channel depths is performed, and the method BlendWithAlpha applies the prepared watermark to the page.