水印图像正在调整大小. [英] watermark image is being resized.

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

问题描述

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

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();

推荐答案

有没有一种方法可以首先调整图像的大小,然后将水印添加到文件中?
除非您将水印添加为图像的不同图层,否则水印将被调整大小.
Is there a way where you can resize the image first and then add the watermark to the file?
The watermark will get resized unless you add it as a different layer on the image.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆