⑴ 用C#编写图片如何旋转
/*任意角度旋转,但图片本生并不旋转,显示时候是旋转*/
int Angle=30;//Angle为旋转的角度
Graphics g = picturebox1.CreateGraphics();
TextureBrush mybrush = new TextureBrush(SrcBmp);//SrcBmp为原图
mybrush.RotateTransform(Angle);//旋转
g.FillRectangle(mybrush, 0, 0,Picturebox1.Width, picturebox1.Height);
/*旋转90,180,主图片本生旋转,但只能旋转90的倍数*/
Bitmap bmp=new Bitmap(filepath);
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
⑵ C# 中怎样是图片旋转90度
public static Bitmap KiRotate90(Bitmap img)
...{
try
...{
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
return img;
}
catch
...{
return null;
}
}
很容易就看出来,关键在于RotateFlipType参数。
实践结果如下:
顺时针旋转90度 RotateFlipType.Rotate90FlipNone
逆时针旋转90度 RotateFlipType.Rotate270FlipNone
水平翻转 RotateFlipType.Rotate180FlipY
垂直翻转 RotateFlipType.Rotate180FlipX
⑶ 关于要怎么点击一张图片实现有反转效果,点击正面反转成另一张图片,用javascript 和css应
<html>
<title>js实现按钮控制图片90度翻转特效</title>
<body>
<script language="javascript">
var isIE = (document.uniqueID)?1:0;
var i=1;
function rotate(image)
{
var object = image.parentNode;
if(isIE){
image.style.filter="progid:dXImagetransform.Microsoft.basicImage(rotation="+i+")";
i++;
if(i>4) {i=1};
}
else{
try{
var canvas = document.createElement('canvas');
if(canvas.getContext("2d")) {
object.replaceChild(canvas,image);
var context = canvas.getContext("2d");
context.translate(300, 0);
context.rotate(Math.PI*0.5);
context.drawImage(image,0,0);
}
}catch(e){}
}
}
</script>
<input type="button" value="点击旋转图片" onclick="rotate(document.getElementById('myimg'))" /><br />
<img id="myimg" src="1.jpg"/>
<!-- 图片路径你自己替换 -->
</body>
</html>
⑷ c#中的picturebox中的图形怎么旋转
引用例子: //任意角度旋转 private void RotateTransformButton_Click(object sender, EventArgs e) { try { Bitmap a = new Bitmap(pictureBox1.Image);//得到图片框中的图片 pictureBox1.Image = Rotate(a, Convert.ToInt32(textBox1.Text));...
⑸ 用c#将图像旋转180度,90度
使用RotateFlip方法,具体参看MSDN
Bitmap bitmap1;
private void InitializeBitmap()
{
try
{
bitmap1 = (Bitmap)Bitmap.FromFile(@"C:\Documents and Settings\" +
@"All Users\Documents\My Music\music.bmp");
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
PictureBox1.Image = bitmap1;
}
catch(System.IO.FileNotFoundException)
{
MessageBox.Show("There was an error." +
"Check the path to the bitmap.");
}
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
if (bitmap1 != null)
{
bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY);
PictureBox1.Image = bitmap1;
}
}
⑹ html 图片翻转 请给例子
你可以参考一下如下代码
<title>javascript图片轮换</title>
<style type="text/css">
#album{
position:relative;
width:400px;
height:300px;
border:10px solid #EFEFDA;
overflow:hidden;
}
#album dt {
margin:0;
padding:0;
width:400px;
height:300px;
overflow:hidden;
}
#album img {
border:2px solid #000;
}
#album dd {
position:absolute;
right:0px;
bottom:10px;
}
#album a {
display:block;
float:left;
margin-right:10px;
width:15px;
height:15px;
line-height:15px;
text-align:center;
text-decoration:none;
color:#808080;
background:transparent url(/jscss/demoimg/200910/o_button.gif) no-repeat -15px 0;
}
#album a:hover ,#album a.hover{
color:#F8F8F8;
background-position:0 0;
}
</style>
<dl id="album">
<dt>
<img id="index1" alt=余秋的黄昏" src="E:\公司网站\image\wall3.jpg" />
<img id="index2" alt="美丽欧洲" src="E:\公司网站\image\wall4.jpg" />
<img id="index3" alt="巨石阵的神秘" src="E:\公司网站\image\wall5.jpg" />
</dt>
<dd>
<a href="#index1">1</a><a href="#index2">2</a><a href="#index3">3</a>
</dd>
</dl>
<script type="text/javascript">
function imageRotater(id){
var cases = "",
album = document.getElementById(id),
images = album.getElementsByTagName("img"),
links = album.getElementsByTagName("a"),
dt = album.getElementsByTagName("dt")[0],
length = images.length,
aIndex = 1,
aBefore = length;
for(var i=0;i< length;i++){
cases += images[i].id + ':"'+images[i].getAttribute("src")+'",'
}
images[0].style.cssText = "position:absolute;top:0;left:0;";//修正图片位置错误
var tip = document.createElement("dd");
tip.style.cssText = "position:absolute;bottom:0;height:20px;width:380px;padding:10px;color:#fff;background:#fff;";
album.insertBefore(tip,dt.nextSibling);
if(!+"\v1"){
tip.style.color = "#369";
tip.style.filter = "alpha(opacity=67)"
}else{
tip.style.cssText += "background: rgba(164, 173, 183, .65);"
}
cases = eval("({"+cases.replace(/,$/,"")+"})");
for(var i=0;i<length;i++){
links[i].onclick = function(e){
e =e || window.event;
var index = this.toString().split("#")[1];
aIndex = index.charAt(index.length-1);//☆☆☆☆
images[0].src = cases[index];
tip.innerHTML = images[aIndex -1].getAttribute("alt");
!+"\v1" ?(e.returnValue = false) :(e.preventDefault());
}
}
var prefix = images[0].id.substr(0,images[0].id.length -1);
(function(){
setTimeout(function(){
if(aIndex > length){
aIndex = 1;
}
images[0].src = cases[prefix+aIndex];
tip.innerHTML = images[aIndex -1].getAttribute("alt");
tip.style.bottom = "-40px";
links[aBefore-1].className = "";
links[aIndex-1].className = "hover";
aBefore = aIndex;
aIndex++;
move(tip);
setTimeout(arguments.callee,1500)
},1500)
})()
var move = function(el){
var begin = parseFloat(el.style.bottom),
speed = 1;
el.bottom = begin;
(function(){
setTimeout(function(){
el.style.bottom = el.bottom + speed + "px";
el.bottom += speed;
speed *= 1.5;//下一次移动的距离
if(el.bottom >= 0){
el.style.bottom = "0px";
}else{
setTimeout(arguments.callee,23);
}
},25)
})()
}
}
window.onload = function(){
try{document.execCommand("BackgroundImageCache", false, true);}catch(e){};
imageRotater("album");
}
</script>
⑺ 有没有懂opencv的facedetect里面的tryflip为啥要让图像翻转继续检测
镜面效果
步骤如下:
我们1,打开“画布大小”对话框。
在Photoshop中,您可以通过选择“图像”>增加图像画布大小(实际的工作区)“画布大小”。在这个屏幕图像,我们看到了原始图像的实际大小。当你第一次打开“画布大小”,井字形网状框的中心将被阴影。有限公司2,增加画布大小。
到下一个步骤就是增加了“画布大小”(这里仍是指实际工作区域)。我们可以通过下面的方法“画布大小”增加:阴影框移动到任何其他复选框,然后输入一个新的高度和/或宽度尺寸。因为我想增加身高的“画布大小”,在画面留出更多空间的底部,所以我搬到了盒子的中间阴影区域的顶部。然后我输入一个新的画布大小 - 为了便于使用的,尺寸比原照片高度的两倍稍大。
3,创建翻转原始图像的图像。
翻转图像来创建原始图像是非常简单的。第一次使用“选框工具”,选择原始图像区域,在这种情况下,日出美景。然后选择“编辑”>“复制”。
然后选择“文件”>“新建”。新的文件大小,创建的图像完全相同的副本。
现在,选择“编辑”>“粘贴”。所选择的图像将被粘贴到新文档 - 在新层上。
要翻转图像(在这种情况下,垂直翻转),选择“编辑”>“变换”>“垂直翻转”。现在,图像翻转过来。
4,创造一个神奇的镜面效果。
创造神奇的镜面效果,使用“移动”工具,拖动图像翻转?原始图像的空白区域。现在,小心地将两个图像,使它们看起来完全反光镜的。然后,选择“图层”>“扁平化”的形象分裂。
页5,小结。
对于一些垂直镜像(也可创建水平镜像),还有一个有趣的事情是创建原始图像的倒映在水中的效果。以下是实现方法:使用“盒子”工具来选择图像(下半部分)的镜面部分。然后选择“滤镜”>“扭曲”>“海洋波纹”。调整“波纹大小”和“波纹幅度”,直到合适的效果感到满意。点击“好”。然后去“选择”>“取消选择”已应用到取消“海洋波纹”过滤面积。
最后,使用“裁剪”工具切割成所需的图片看看。
⑻ java实现图片旋转90度的问题
类Graphics2D的方法rotate(double theta, double x,
double y)可以用来旋转图片
⑼ java 怎么让一个图形绕一个点旋转360度
⑽ C#图片怎么翻转
在界面刚初始化之后的
“private void Form_XX_Load(object sender, EventArgs e)”函数中添加: “pictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipX);
pictureBox1.Refresh();”
这两句就行了。