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

        };

    }

  • 相关阅读:
    使用jquery.mobile和WebSQL实现记事本功能
    jqprint的网页打印,打印预览可以包含图片
    JDBC--处理Blob
    JDBC--DAO设计模式
    JDBC--使用beanutils工具类操作JavaBean
    JDBC--利用反射及JDBC元数据编写通用的查询方法
    JDBC--PreparedStatement使用
    JDBC--Statement使用
    JDBC--获取数据库连接
    Oracle笔记--PL/SQL(Procedure Language & Structured Query Language)
  • 原文地址:https://www.cnblogs.com/elvisyzhao/p/2619530.html
Copyright © 2020-2023  润新知