![]() |
Multimedia »
General Graphics »
Graphics
Intermediate
Watermark CreatorBy Big DA tool which overlays a watermark and/or copyright statement on the bottom of an image. |
C#, Windows, .NET 1.0, .NET 1.1, .NET 2.0, GDI+, WinForms, VS.NET2003, VS2005, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||

I wanted to watermark a few sunset images taken by me, before posting it to internet. After searching for an hour or so, I couldn't find any freeware tool. All were shareware, means you have to buy, #$#$!@##!#@#@. I decided to make a tool on my own, many thanks to Joel Neubeck's article in CodeProject. Using his article, I just tried to create a proper user friendly GUI tool to mark images with copyright note, also optionally with your company logo.
You can call the tool Watermark Creator, Watermark tool or anything. I named it as MarkMyImage.

The above image is taken from the internet, copyright to respected owner.
You can download the source code, and modify it according to your needs, though I feel you need not modify anything :-).
Form_Load takes values from the system registry and initializes the screen.
Form_Closed saves all the current settings into the registry. Class Watermark has two constructors, with or without the watermark image.
WaterMark(string WorkingDirectory, string Copyright, Image ImgWatermark);
WaterMark(string WorkingDirectory, string Copyright);
According to user choice (watermark image preference), we will create the WaterMark object by passing the necessary parameters...
if (chkWaterMarkImage.Checked == true)
wm = new WaterMark(txtWorkingFolder.Text,
txtCopyRight.Text,picWaterMark.Image);
else
wm = new WaterMark(txtWorkingFolder.Text,txtCopyRight.Text);
Now, a simple execution loop for all the selected files.
for(int i=0;i<lstFileList.CheckedItems.Count;i++)
{
srcPic = txtWorkingFolder.Text +
lstFileList.Items[i].ToString().Substring(
lstFileList.Items[i].ToString().LastIndexOf("\\"));
if (chkSameOutputFolder.Checked == true)
dstPic = srcPic.Insert(srcPic.LastIndexOf("."),txtSuffix.Text);
else
dstPic = txtOutputFolder.Text + "\\" +
srcPic.Substring(srcPic.LastIndexOf("\\") + 1);
wm.MarkImage(srcPic,dstPic);
progressBar1.Increment(1);
statusBarPanel2.Text = "Proecessing Image " +
srcPic.Substring(lstFileList.Items[i].ToString().LastIndexOf("\\") + 1);
Application.DoEvents();
}
PropertyGrid control.
PropertyGrid control. It uses PropertyInfo of System.Reflection. Take a look at the following block of code: PropertyInfo[] props = this.GetType().GetProperties();
for (int i=0; i<props.Length; i++)
{
object[] attrs =
props[i].GetCustomAttributes(typeof(DefaultValueAttribute),false);
if (attrs.Length > 0)
{
DefaultValueAttribute attr = (DefaultValueAttribute)attrs[0];
props[i].SetValue(this,attr.Value,null);
}
}
props.
attrs.
DefaultValueAttribute.
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 20 Jun 2005 Editor: Smitha Vijayan |
Copyright 2005 by Big D Everything else Copyright © CodeProject, 1999-2009 Web17 | Advertise on the Code Project |