導航:首頁 > 動漫圖片 > try怎麼翻轉圖片

try怎麼翻轉圖片

發布時間:2022-06-15 13:09:49

⑴ 用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度

  1. importjava.awt.Canvas;
  2. importjava.awt.Graphics;
  3. importjava.awt.Graphics2D;
  4. importjava.awt.RenderingHints;
  5. importjava.awt.image.BufferedImage;
  6. /**
  7. *@authorZhengYesheng
  8. */
  9. {
  10. =-1997487731464495923L;
  11. BufferedImageimg;
  12. BufferedImagerotatedImg;
  13. intdegress=0;
  14. publicRotateImageCanvas(BufferedImageimg)
  15. {
  16. super();
  17. this.img=img;
  18. newThread(this).start();
  19. }
  20. @Override
  21. publicvoidrun()
  22. {
  23. while(true)
  24. {
  25. //A,與B的代碼配合決定旋轉的速度
  26. degress+=1;
  27. degress%=360;
  28. repaint();
  29. try
  30. {
  31. if(degress==0)
  32. {
  33. //繞一周後等待的時間在這里設置
  34. Thread.sleep(3*1000);
  35. }
  36. else
  37. {
  38. //考慮到視覺平滑,這里不應大約40。
  39. Thread.sleep(30);
  40. }
  41. }
  42. catch(InterruptedExceptione)
  43. {
  44. //TODOAuto-generatedcatchblock
  45. e.printStackTrace();
  46. }
  47. }
  48. }
  49. @Override
  50. publicvoidpaint(Graphicsgraphics)
  51. {
  52. super.paint(graphics);
  53. //獲取旋轉指定角度後的圖片。為了避免累計誤差,這里是用原始圖像旋轉的
  54. rotatedImg=rotateImage(img,degress);
  55. //繪制旋轉後的圖片
  56. graphics.drawImage(rotatedImg,0,0,this);
  57. }
  58. /**
  59. *旋轉圖片為指定角度。
  60. *注意:1、這個方法實現了圖像的基於中點的旋轉,要想繞指定點,需要配合Matrix類
  61. *2、為避免圖像被裁切,結果圖片的尺寸也需要動態計算
  62. *3、現在旋轉後有黑色背景,如果不需要這個效果,需要設置結果圖片的Alpha模式
  63. *
  64. *@parambufferedimage
  65. *目標圖像
  66. *@paramdegree
  67. *旋轉角度
  68. *@return
  69. */
  70. (BufferedImagebufferedimage,intdegree)
  71. {
  72. intw=bufferedimage.getWidth();
  73. inth=bufferedimage.getHeight();
  74. inttype=bufferedimage.getColorModel().getTransparency();
  75. BufferedImageimg;
  76. Graphics2Dgraphics2d;
  77. (graphics2d=(img=newBufferedImage(w,h,type)).createGraphics())
  78. .setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
  79. graphics2d.rotate(Math.toRadians(degree),w/2,h/2);
  80. graphics2d.drawImage(bufferedimage,0,0,null);
  81. graphics2d.dispose();
  82. returnimg;
  83. }
  84. }

⑽ C#圖片怎麼翻轉

在界面剛初始化之後的
「private void Form_XX_Load(object sender, EventArgs e)」函數中添加: 「pictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipX);
pictureBox1.Refresh();」
這兩句就行了。

閱讀全文

與try怎麼翻轉圖片相關的資料

熱點內容
動畫高清圖片貼紙專用 瀏覽:569
如何把批註圖片變小 瀏覽:571
普提樹高清圖片 瀏覽:766
空乘的發型圖片 瀏覽:307
圖片怎麼列印出來a4 瀏覽:628
小學詩歌圖片手繪畫四年級簡單 瀏覽:435
齊頭發半扎頭發型圖片大全 瀏覽:801
如何找到雙層空間的圖片 瀏覽:778
動漫小妞圖片 瀏覽:760
植物簡單畫圖片大全 瀏覽:728
側臉女生流淚圖片 瀏覽:50
怎麼把好幾頁word圖片弄成一頁 瀏覽:451
動漫圖片男生帥氣冷酷簡筆畫 瀏覽:866
百姓問政文字圖片 瀏覽:362
如何畫植樹手抄報圖片大全 瀏覽:419
如何把圖片中字弄清晰 瀏覽:468
雜志如何做圖片 瀏覽:337
word圖片拉大後列印出來有白邊 瀏覽:631
時尚女孩服裝搭配圖片 瀏覽:445
男生頭像圖片背影黑白 瀏覽:501