Add picture copyright information to the picture
Last Update:2017-02-28
Source: Internet
Author: User
This example is mainly about how to add a copyright image to the upload image.
Parameter number: filename, outfilename, copyrightfile If you are developing under the Web, be sure to use a virtual path.
If it is a Windows desktop program, use Application.startuppath.
Or both are in absolute paths.
When this method is invoked, the picture must be uploaded to the server and processed on the server side.
You must also specify whether the original, unhandled picture is deleted.
<summary>
Add picture copyright information to the picture
</summary>
<param name= "FileName" > Original picture </param>
<param name= "Outfilename" > Output picture </param>
<param name= "Copyrightfile" > Copyright Pictures </param>
<param name= "DeleteFile" > Delete original picture </param>
<param name= "x" > Copyright pictures show X-axis coordinates </param>
<param name= "y" > Copyright picture shows the y-axis coordinates </param>
public void Createcopyrightimage (string fileName, String outfilename, String copyrightfile, bool DeleteFile, float x, Floa T y)
{
System.Drawing.Image Image = System.Drawing.Image.FromFile (fileName);
System.Drawing.Image c_image = System.Drawing.Image.FromFile (copyrightfile);
System.Drawing.Bitmap outPut = new System.Drawing.Bitmap (image);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage (OutPut);
G.drawimage (C_image, x, y);
String extend = Filename.substring (Filename.lastindexof (".") + 1). ToLower ();
Switch (Extend)
{
Case "BMP":
Output.save (Outfilename, SYSTEM.DRAWING.IMAGING.IMAGEFORMAT.BMP);
Break
Case "JPG":
Output.save (Outfilename, System.Drawing.Imaging.ImageFormat.Jpeg);
Break
Case "GIF":
Output.save (Outfilename, System.Drawing.Imaging.ImageFormat.Gif);
Break
Case "icon":
Output.save (Outfilename, System.Drawing.Imaging.ImageFormat.Icon);
Break
Case "PNG":
Output.save (Outfilename, System.Drawing.Imaging.ImageFormat.Png);
Break
Case "TIF":
Output.save (Outfilename, System.Drawing.Imaging.ImageFormat.Tiff);
Break
Default:
Output.save (Outfilename, System.Drawing.Imaging.ImageFormat.Jpeg);
Break
}
G.dispose ();
Output.dispose ();
Image. Dispose ();
C_image. Dispose ();
if (DeleteFile)
{
System.IO.File.Delete (FileName);
}
}