using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections; using System.ComponentModel; namespace Test.Com {///
// maximum aperture value of public MetadataDetail SubjectDist; // Subject distance public MetadataDetail LightSource; // balance public MetadataDetail FocalLength; // focal length public MetadataDetail FPXVer; // FlashPix version of the public MetadataDetail ColorSpace; // color space public MetadataDetail Interop; // public MetadataDetail flashEnergy; // public MetadataDetail SpatialFR; // public MetadataDetail FocalXRes; // public MetadataDetail FocalYRes; // public MetadataDetail FocalResUnit; // public MetadataDetail exposureIndex; // exposure index public MetadataDetail sensingMethod; // induction public MetadataDetail sceneType; // public MetadataDetail CfaPattern; //} #endregion #region lookup EXIF element value public string LookupEXIFValue (string Description, string value) {string DescriptionValue = null; switch (Description) {case "meteringMode": #region meteringMode {switch (value ) {CASE "0": descriptionValue = "unknown"; break; case "1": descriptionValue = "average"; Break; CASE "2": descriptionValue = "center weighted average"; break; case "3": descriptionValue = "spot"; break; case "4": descriptionValue = "multi-spot"; break; case "5": descriptionValue = "Multi-segment"; break; case "6": descriptionValue = "partial"; break; case "255": descriptionValue = "other"; break;}} #endregion break; copy "resolutionUnit": #region resolutionunit {switch (Value) {CASE "1": descriptionValue = "no units"; Break;
Case "2": descriptionValue = "inch"; break; case "3": descriptionValue = "centimeter"; break;}} #ENDREGON BREAK; / / 省略 N-line similar code} Return DescriptionValue;} #endregion #region get pictures EXIF Information Public Metadata getExifMetadata (String Photoname) {// Create an instance system.drawing.image myimage = system.drawing.image.fromfile (Photoname); // Create a integer array to store an attribute group in the image ID int [] MyPropertyIdList = MyImage.PropertyIdList; // create a closed array of image attributes instances PropertyItem [] MyPropertyItemList = new PropertyItem [MyPropertyIdList.Length]; // Create a structural example of the image information of the object EXIT, and the initial value # Region creates an instance structure object of an image EXIT information, and assigns genadata mymetadata = new metadata (); mymetadata.equipmentmake.hex = "10f"; mymetadata.cameramodel.hex = "110"; mymetadata.datePictTureTaken.Hex = " 9003 "; mymetadata.exposuretime.hex =" 829a "; mymetadata.fstop.hex =" 829d "; mymetadata.shutterspeed.Hex =" 9201 "; mymetadata.meteringmode.Hex =" 9207 "; mymetadata.flash.Hex =" 9209 "; mymetadata.fnumber.Hex =" 829 D "; // mymetadata.exposureprog.hex =" "; // mymetadata.spectralsense.Hex =" 8824 "; // mymetata.isospeed.Hex =" 8827 "; // mymetadata.oecf.Hex =" 8828 "; // mymetadata.ver.hex = "9000"; // mymetadata.compconfig.Hex = "9101"; // mymetadata.compbpp.Hex = "9102"; // mymetadata.Aperture.Hex = "9202"; // Mymetadata.brightness.Hex = "9203"; // mymetadata.exposurebias.hex = "9204";
// mymetadata.maxaperture.hex = "9205"; // mymetadata.subjectd.Hex = "9206"; // mymetadata.lightsource.Hex = "9208"; // mymetadata.focallength.Hex = "920a"; // Mymetadata.fpxver.hex = "a000"; // mymetadata.colorspace.Hex = "A001"; // mymetata.focalxres.Hex = "a20e"; // mymetadata.foCalyRES.HEX = "A20F"; // mymetata. FocalResUnit.hex = "a210"; // mymetadata.exposureIndex.hex = "a215"; // mymetadata.sensingMethod.Hex = "a217"; // mymetadata.sceneType.Hex = "a301"; mymetadata.cfapattern.Hex = "a302"; #endregion // ASCII encoding System.Text.ASCIIEncoding Value = new System.Text.ASCIIEncoding (); int index = 0; int MyPropertyIdListCount = MyPropertyIdList.Length; if (! MyPropertyIdListCount = 0) {foreach (int MyPropertyId in MyPropertyIdList) {string hexVal = ""; MyPropertyItemList [index] = MyImage.GetPropertyItem (MyPropertyId); #region initialization of the attribute value string myPropertyIdString = MyImage.GetPropertyItem (MyPropertyId) .I d.ToString ( "x"); switch (myPropertyIdString) {case "10f": {MyMetadata.EquipmentMake.RawValueAsString = BitConverter.ToString (MyImage.GetPropertyItem (MyPropertyId) .Value); MyMetadata.EquipmentMake.DisplayValue = Value.GetString ( MyPropertyItemList [index] .Value); break;} case "110": {MyMetadata.CameraModel.RawValueAsString = BitConverter.ToString (MyImage.GetPropertyItem (MyPropertyId) .Value); MyMetadata.CameraModel.DisplayValue =