• 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;

        };

    }

  • 相关阅读:
    IssueQuery failed in redmine rake tasks
    rubymine 调试 redmine
    redmine rake tasks
    rails tutorial sample app
    win7 chm 打开失败记录
    rails再体验(第一个程序)
    Bitnami Redmine插件开发记录
    redmine export long csv file failed: 502 proxy error
    Java时区切换时的需要注意
    Android No static field XXX of type I in class Lcom/XXX/R$id错
  • 原文地址:https://www.cnblogs.com/elvisyzhao/p/2619530.html
Copyright © 2020-2023  润新知