使用图像服务器控件,我需要使用c#在asp.net中进行旋转和翻转,缩放,颜色填充的代码 [英] using image server control i need code for rotate and flip,zoom,color cahge in asp.net with c#

查看:150
本文介绍了使用图像服务器控件,我需要使用c#在asp.net中进行旋转和翻转,缩放,颜色填充的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

asp.net中的

如何旋转,翻转,缩放,变色

how to rotate,flip,zoom,color change in asp.net

推荐答案

我建​​议您在此站点上搜索有关图像处理的文章,因为其中有相当多的内容一些.
I would suggest you search this site for articles on image manipulation as there are quite a few.


这与asp.net无关.这是使用框架的问题.

一个简单的谷歌搜索显示了这种旋转图像的方法(使用C#).

This has nothing specifically to do with asp.net. It''s a matter of using the framework.

A simple google search revealed this method for rotating an image (using C#).

#
public static Image RotateImage(Image img, float rotationAngle)
{
    //create an empty Bitmap image
    Bitmap bmp = new Bitmap(img.Width, img.Height);

    //turn the Bitmap into a Graphics object
    Graphics gfx = Graphics.FromImage(bmp);

    //now we set the rotation point to the center of our image
    gfx.TranslateTransform((float)bmp.Width / 2, (float)bmp.Height / 2);
 
    //now rotate the image
    gfx.RotateTransform(rotationAngle);
 
    gfx.TranslateTransform(-(float)bmp.Width / 2, -(float)bmp.Height / 2);
 
    //set the InterpolationMode to HighQualityBicubic so to ensure a high
    //quality image once it is transformed to the specified size
    gfx.InterpolationMode = InterpolationMode.HighQualityBicubic;
 
    //now draw our new image onto the graphics object
    gfx.DrawImage(img, new Point(0, 0));
 
    //dispose of our Graphics object
    gfx.Dispose();
 
    //return the image
    return bmp;
} 






使用google不仅简单,而且比发布问题并等待您想要的答案要快得多.






Using google is not only easy, it''s a lot faster than posting a question and waiting for the answer you want.


这篇关于使用图像服务器控件,我需要使用c#在asp.net中进行旋转和翻转,缩放,颜色填充的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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