I am attempting to apply a watermark (string) with some opacity (css attribute) to both an image and a pdf using itext.
For the pdf, I can simply use:
PdfGState gstate = new PdfGState();
gstate.FillOpacity = textOpacity;
Everything works fine. However, for the image, I am using:
Color color = Color.FromArgb(int alpha, Color color)
My question is how to convert css opacity to alpha?
I came across the formula: opacity = (255 - transparency) / 255.0
Is this correct? Because if my opacity is 1f (no opacity), the alpha will be 0 resulting in fully transparent text...