成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

使用C#旋轉圖片:EXIF

開發 后端
本文詳細介紹了C#實現根據圖片的EXIF自動調整圖片方向的方法,希望對大家有用。

 一、什么是EXIF

Exif是英文Exchangeable Image File(可交換圖像文件)的縮寫,最初由日本電子工業發展協會(JEIDA --Japan Electronic Industry Development Association) 制訂,目前的最新版本是發表于2002年04月的2.21 版。國際標準化組織(ISO)正在制訂的相機文件設計標準(DCF -- Design role for Camera File system)可能以Exif2.1為基礎。

所有的JPEG文件以字符串“0xFFD8”開頭,并以字符串“0xFFD9”結束。文件頭中有一系列“0xFF??”格式的字符串,稱為“標識”,用來標記JPEG文件的信息段?!?xFFD8”表示圖像信息開始,“0xFFD9”表示圖像信息結束,這兩個標識后面沒有信息,而其它標識緊跟一些信息字符。

0xFFE0 -- 0xFFEF之間的標識符稱為“應用標記”,沒有被常規JPEG文件利用,Exif正是利用這些信息串記錄拍攝信息如快門速度、光圈值等,甚至可以包括全球定位信息。其中拍攝方向的ID為“0x0112”,有1至8共8種值。而C#旋轉圖片可以通過EXIF來實現。

EXIF圖1

二、EXIF Orientation

  1. Orientation   
  2. The image orientation viewed in terms of rows and columns.   
  3. Tag = 274 (112.H)   
  4. Type = SHORT   
  5. Count = 1   
  6. Default = 1   
  7. 1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.   
  8. 2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.   
  9. 3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.   
  10. 4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.   
  11. 5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.   
  12. 6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.   
  13. 7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.   
  14. 8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.   
  15. Other = reserved 

三、使用C#旋轉圖片

  1. public static void rotating(Bitmap img,ref int width, ref int height, int orien)  
  2. {  
  3.     int ow = width;  
  4.     switch (orien)  
  5.     {  
  6.         case 2:  
  7.             img.RotateFlip(RotateFlipType.RotateNoneFlipX);//horizontal flip  
  8.             break;  
  9.         case 3:  
  10.             img.RotateFlip(RotateFlipType.Rotate180FlipNone);//right-top  
  11.             break;  
  12.         case 4:  
  13.             img.RotateFlip(RotateFlipType.RotateNoneFlipY);//vertical flip  
  14.             break;  
  15.         case 5:  
  16.             img.RotateFlip(RotateFlipType.Rotate90FlipX);  
  17.             break;  
  18.         case 6:  
  19.             img.RotateFlip(RotateFlipType.Rotate90FlipNone);//right-top  
  20.             width = height;  
  21.             height = ow;  
  22.             break;  
  23.         case 7:  
  24.             img.RotateFlip(RotateFlipType.Rotate270FlipX);  
  25.             break;  
  26.         case 8:  
  27.             img.RotateFlip(RotateFlipType.Rotate270FlipNone);//left-bottom  
  28.             width = height;  
  29.             height = ow;  
  30.             break;  
  31.         default:  
  32.             break;  
  33.     }  

至此,使用C#旋轉圖片的目的就達到了。

【編輯推薦】

  1. C#代碼與#函數相互調用問題集錦
  2. 如何使用泛型達到代碼重用的目的
  3. 線性鏈表測試方法簡介
  4. 創建一個簡單的線性鏈表
  5. C#事件模型的一個實例
責任編輯:book05 來源: cnblogs
相關推薦

2009-08-20 12:35:41

C#讀取圖片的EXIF

2024-09-11 14:46:48

C#旋轉按鈕

2009-08-25 16:49:44

C#使用if語句

2009-08-31 16:12:02

C#使用Singlet

2009-08-14 15:23:10

C#使用ErrorPr

2009-08-19 14:26:58

C# JavaScri

2009-08-20 13:23:28

C#使用Crystal

2009-08-18 17:29:02

C#使用指針

2009-09-01 09:16:57

C#使用SharpZi

2024-04-19 08:31:40

Android屬性讀取

2024-07-04 08:26:12

AndroidJPEG圖片

2015-09-16 15:11:58

C#異步編程

2009-08-20 11:03:34

Visual C#使用

2009-08-27 15:17:18

C# interfacinterface使用

2009-09-11 11:27:38

AttributeUsC# Attribut

2009-08-25 16:29:33

C#使用sqlserv

2009-08-06 16:44:03

C#創建WebServ

2009-08-19 17:45:26

C#使用GDI+

2009-08-25 16:14:06

C#使用ADOX

2009-08-13 13:29:04

C#結構體使用
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 午夜精品一区二区三区在线观看 | 亚洲成人在线视频播放 | 精彩视频一区二区三区 | 天堂素人约啪 | 性色av一区二区三区 | 亚洲成人精品国产 | 国产www.| 亚洲黄色一级毛片 | 国产精品99久久久久久动医院 | 国产无套一区二区三区久久 | jizz中国日本| 成人自拍av| 国产精品久久网 | 欧美精品欧美精品系列 | 95国产精品 | 久久国产激情视频 | 在线看黄免费 | 99精品久久99久久久久 | 欧美激情国产日韩精品一区18 | 午夜影院在线观看版 | 亚洲综合精品 | 亚洲第1页 | 国产高潮好爽受不了了夜色 | 国产日韩欧美二区 | 久久一日本道色综合久久 | 久久999| 亚洲一区中文字幕 | 色偷偷噜噜噜亚洲男人 | 亚洲一区免费在线 | 天天插日日操 | 四季久久免费一区二区三区四区 | 新超碰97| 免费人成激情视频在线观看冫 | 一区二区三区四区在线 | 秋霞a级毛片在线看 | 国产一区二区在线播放 | 男女免费网站 | 亚洲国产一区视频 | 91精品国产一区二区三区 | 久在线| 精品久久电影 |