zoukankan      html  css  js  c++  java
  • iOS读取图片附加信息

    首先需要引入ALAssetsLibrary库。

    首先需要用户授予定位服务权限。

    读取图片附加信息的代码如下:

     1  NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];
     2             
     3 ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
     4 [library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
     5     NSDictionary *metadata = asset.defaultRepresentation.metadata;
     6 
     7     NSLog(@"%@", metadata);
     8 }
     9 failureBlock:^(NSError *error) {}];

    打印出的图片附加信息如下:

    {

        ColorModel = RGB;

        DPIHeight = 72;

        DPIWidth = 72;

        Depth = 8;

        Orientation = 3;

        PixelHeight = 1936;

        PixelWidth = 2592;

        "{Exif}" =     {

            ApertureValue = "2.970854";

            ColorSpace = 1;

            ComponentsConfiguration =         (

                1,

                2,

                3,

                0

            );

            DateTimeDigitized = "2012:08:01 19:39:08";

            DateTimeOriginal = "2012:08:01 19:39:08";

            ExifVersion =         (

                2,

                2,

                1

            );

            ExposureMode = 0;

            ExposureProgram = 2;

            ExposureTime = "0.06666667";

            FNumber = "2.8";

            Flash = 16;

            FlashPixVersion =         (

                1,

                0

            );

            FocalLength = "3.85";

            ISOSpeedRatings =         (

                100

            );

            MeteringMode = 5;

            PixelXDimension = 2592;

            PixelYDimension = 1936;

            SceneCaptureType = 0;

            SensingMethod = 2;

            Sharpness = 2;

            ShutterSpeedValue = "3.9112";

            SubjectArea =         (

                1295,

                967,

                699,

                696

            );

            WhiteBalance = 0;

        };

        "{GPS}" =     {

            Altitude = "84.62079";

            AltitudeRef = 0;

            ImgDirection = "75.96286";

            ImgDirectionRef = T;

            Latitude = "39.89233333333333";

            LatitudeRef = N;

            Longitude = "116.4566666666667";

            LongitudeRef = E;

            TimeStamp = "11:52:22.00";

        };

        "{TIFF}" =     {

            DateTime = "2012:08:01 19:39:08";

            Make = Apple;

            Model = "iPhone 4";

            Orientation = 3;

            ResolutionUnit = 2;

            Software = "4.3.3";

            XResolution = 72;

            YResolution = 72;

            "_YCbCrPositioning" = 1;

        };

    }

  • 相关阅读:
    2008俱乐部高校行之中南民族大学
    [更新]MSDN中Webcast "WPF中的图形系统系列" 课程预告及反馈
    7月20日 武汉.NET俱乐部在线沙龙!
    2007武汉.NET俱乐部沙龙VS2008、WPF、Silverlight
    MSDN新年第一次WebCast总结
    [评]Microsoft Visual Web Developer 2008 Step by Step, Express Edition
    [老爸创作的歌词]我从瓦砾中站起
    [Expert MS IL Assembler]武汉.NET俱乐部在线沙龙与线下聚会
    2008开年大礼:《Application = Code + Markup》中文版面世
    2009武汉.NET俱乐部活动之黄冈站
  • 原文地址:https://www.cnblogs.com/elvisyzhao/p/2619530.html
Copyright © 2011-2022 走看看