Add picture copyright information to the picture

Source: Internet
Author: User
Tags extend
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);
}
}




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.