Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Mike_Lowe  
#1 Posted : Friday, May 27, 2005 6:42:00 PM(UTC)
Mike_Lowe

Rank: Member

Groups: Member
Joined: 5/27/2005(UTC)
Posts: 4

Hi,

My client requires huge copyright messages to be dynamically displayed across all images posted on their website. How do I overlay text on an image but allowing the image underneath the text to be still visible (i.e. opacity of the text to be reduced) ? I would appreciate if you could show a quick snippet in C#.

Many thanks,
Mike
Dmitry  
#2 Posted : Friday, May 27, 2005 8:58:00 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello,

You can insert watermarks on your images using the following code snippet:
Code:
// Input text string, offset of text output and source bitmap.
System.String text = "Aurigma Inc.";
System.Drawing.PointF offset = new System.Drawing.PointF(30.0F, 30.0F);
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.Yellow, 
   200, 200, Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

// Convert bitmap to rgb color space.
bitmap.ColorManagement.ConvertToContinuous(Aurigma.GraphicsMill.ColorSpace.Rgb, false, false);

// Create font instance.
System.Drawing.Font font = new System.Drawing.Font("Arial", 14);
System.Drawing.Graphics graphics = bitmap.GetGdiplusGraphics();
try
{
	// Create solid brush with opacity.
	System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(Color.FromArgb(0x9F, 0x00, 0x00, 0x00));

	// Draw text string.
	graphics.DrawString(text, font, brush, offset);
}
finally
{
	font.Dispose();
	graphics.Dispose();
}

// Save result bitmap.
bitmap.Save(@"c:/1.png");

If you have some questions, please fill free to contact me.

Edited by user Sunday, December 23, 2007 6:15:11 PM(UTC)  | Reason: Not specified

Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
Mike_Lowe  
#3 Posted : Saturday, May 28, 2005 6:51:00 AM(UTC)
Mike_Lowe

Rank: Member

Groups: Member
Joined: 5/27/2005(UTC)
Posts: 4

Thank you for your suggestion.

Mike
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.