Add a picture copyright information on the image

xiaoxiao2021-03-06  52

This example is mainly how to join a copyright picture on the upload image.

Number of parameters: filename, outfilename, CopyrightFile If you develop under Web, you must use the virtual path.

If it is a Windows desktop, use Application.startupPath.

Or both are in absolute paths.

When calling the method, you must first upload the image to the server, and then processed on the server side.

Also specified, whether the original unprocessed picture is deleted.

///

/// Add a copyright information on the image /// /// Original image /// Output Image /// copyright picture /// Whether to delete the original picture /// copyright picture displayed X-axis coordinate /// copyright picture displayed Y-axis coordinate public void createcopyrightImage (String FileName, String Outfilename, String Copyrightfile, bool deleteFile, float x, float 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) {copy "bmp": Output.save (outfilename, system.drawing.imaging.imageformat.bmp); Break; Case "JPG": Output .Save (Outfil) eName, 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.Image.imageFormat.tiff); Break;

转载请注明原文地址:https://www.9cbs.com/read-115744.html

New Post(0)