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

使用C#旋轉圖片:EXIF

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

 一、什么是EXIF

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

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

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

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#代碼與#函數(shù)相互調用問題集錦
  2. 如何使用泛型達到代碼重用的目的
  3. 線性鏈表測試方法簡介
  4. 創(chuàng)建一個簡單的線性鏈表
  5. C#事件模型的一個實例
責任編輯:book05 來源: cnblogs
相關推薦

2009-08-20 12:35:41

C#讀取圖片的EXIF

2024-09-11 14:46:48

C#旋轉按鈕

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

2009-08-25 16:49:44

C#使用if語句

2009-08-14 15:23:10

C#使用ErrorPr

2009-08-31 16:12:02

C#使用Singlet

2024-04-19 08:31:40

Android屬性讀取

2024-07-04 08:26:12

AndroidJPEG圖片

2009-08-13 13:29:04

C#結構體使用

2009-08-13 15:48:57

C#指針

2009-08-11 13:27:22

C#創(chuàng)建Web Ser

2009-08-21 15:16:23

C#使用指針

2009-08-19 15:18:53

迭代器

2009-08-19 16:42:41

C#如何使用XML

2009-08-27 17:47:21

c#皮膚

2015-09-16 15:11:58

C#異步編程

2009-08-20 11:03:34

Visual C#使用
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 国产乱码精品1区2区3区 | 五月天婷婷狠狠 | 五月婷婷导航 | 中文字幕在线看人 | 国产视频亚洲视频 | 久久一| 欧美一级黄色网 | 在线观看成人 | 欧美区日韩区 | 日韩精品成人 | 午夜影院视频在线观看 | 欧美精品一区二区在线观看 | 国产精品视频在线播放 | 看一级毛片 | 国产精品久久毛片av大全日韩 | 色综合久久久久 | 欧美综合在线观看 | 欧美精品一区在线发布 | 天天成人综合网 | 91在线网站| aaa天堂| 成人国产在线视频 | 免费观看色 | 91精品免费视频 | 免费一级片 | 欧美日韩1区2区3区 欧美久久一区 | 久久成人一区 | 欧美一级黄带 | 99这里只有精品视频 | 久久精品国产亚洲夜色av网站 | 91久久久久久 | 精品伊人久久 | 中文字幕日韩av | 国产玖玖 | 四虎影院免费在线 | 欧美一级免费看 | 国产成人一区二区三区久久久 | 国产www成人| 日韩在线一区二区 | 久久久观看 | 在线国产一区二区 |