⑴ 用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();」
這兩句就行了。