本文介绍了水印图像正在调整大小.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的代码中,我要确保水印图像不会随裁切后的图像调整大小.我希望水印图像保持原样.任何帮助将不胜感激.

In the below code I would like to make sure that the water mark image does not get resize with the cropped image. I would like the water mark image to remain it;s original size. Any help would be appreciated.

// Thumbnail-size image
                   Byte[] byteBLOBData = new Byte[0];

                   byteBLOBData = (byte[])dReader["p_Image"];

                   ImageExtension = dReader["p_Type"].ToString();

                   MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);

                   stmBLOBData.Write(byteBLOBData, 0, byteBLOBData.Length);
                   System.Drawing.Image returnImage = System.Drawing.Image.FromStream(stmBLOBData, false, false);

                   //define a string of text to use as the Copyright message
                   string Copyright = "Copyright © 2011 - OmegaLove.com";
                   //add fading to logo image  using TextureBrush
                   System.Drawing.Image waterMarkimage = System.Drawing.Image.FromFile (
                       (System.Web.HttpContext.Current.Server.MapPath("~/Images/Watermark/watermark.jpg")));
                   System.Drawing.Image wm = Watermark.SetOpacity(waterMarkimage, 150);
                   System.Drawing.Image cropImage = ImageHandler.ImageCrop(returnImage, 100, 160,
                       ImageHandler.AnchorPosition.Bottom);
                   Graphics g = System.Drawing.Graphics.FromImage(cropImage);
                   Point point = new Point(cropImage.Width / 3, cropImage.Height / 2);
                   g.DrawImage(wm, point);


                   // Set the page's content type to JPEG files
                   // and clear all response headers.
                   context.Response.ContentType = "image/jpeg";
                   context.Response.Clear();

                   // Buffer response so that page is sent
                   // after processing is complete.
                   context.Response.BufferOutput = true;

                   // Save the bitmap to the response stream and
                   // convert it to JPEG format.
                   cropImage.Save(context.Response.OutputStream, ImageFormat.Jpeg);
                   waterMarkimage.Dispose();
                   wm.Dispose();
                   g.Dispose();
                   // Release memory.
                   cropImage.Dispose();
                   // Send the output to the client.
                   context.Response.Flush();

推荐答案


这篇关于水印图像正在调整大小.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 05:43