Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iOS上检索图像唯一Id?_Ios_Objective C_Image_Metadata - Fatal编程技术网

如何在iOS上检索图像唯一Id?

如何在iOS上检索图像唯一Id?,ios,objective-c,image,metadata,Ios,Objective C,Image,Metadata,我能够从中提取“图像唯一Id”元数据 下面是我试图从中提取非标准字段的示例 我尝试在iOS上使用这种方法获取元数据 CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)imageData, nil); NSDictionary *metadata = (NSDictionary *)CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(source, 0, nil)

我能够从中提取“图像唯一Id”元数据

下面是我试图从中提取非标准字段的示例

我尝试在iOS上使用这种方法获取元数据

CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)imageData, nil);
NSDictionary *metadata = (NSDictionary *)CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(source, 0, nil));
但它不包含上述属性。
非常感谢您的帮助。

您希望从图像中获取EXIF数据。这里有一些游乐场代码可以实现这一点:

//: Playground - noun: a place where people can play

import UIKit

let url:NSURL = URL(string:"https://mobilesecurity.win/samples/EXIF_example.jpg")! as NSURL
let imageSource = CGImageSourceCreateWithURL(url, nil)!
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil) as! [String:Any]
for (key, value) in imageProperties {
    print("\(key) = \(value)")
}
在上面的示例图像中,结果如下:

PixelHeight = 3024
{Exif} = {
    ApertureValue = "1.695993715632365";
    BrightnessValue = "7.553953257086027";
    ColorSpace = 65535;
    ComponentsConfiguration =     (
        1,
        2,
        3,
        0
    );
    CustomRendered = 2;
    DateTimeDigitized = "2018:05:05 16:58:33";
    DateTimeOriginal = "2018:05:05 16:58:33";
    DigitalZoomRatio = "1.212510024057739";
    ExifVersion =     (
        2,
        2,
        1
    );
    ExposureBiasValue = 0;
    ExposureMode = 0;
    ExposureProgram = 2;
    ExposureTime = "0.003355704697986577";
    FNumber = "1.8";
    Flash = 24;
    FlashPixVersion =     (
        1,
        0
    );
    FocalLenIn35mmFilm = 34;
    FocalLength = "3.99";
    ISOSpeedRatings =     (
        20
    );
    LensMake = Apple;
    LensModel = "iPhone 8 Plus back dual camera 3.99mm f/1.8";
    LensSpecification =     (
        "3.99",
        "6.6",
        "1.8",
        "2.8"
    );
    MeteringMode = 5;
    PixelXDimension = 4032;
    PixelYDimension = 3024;
    SceneCaptureType = 0;
    SceneType = 1;
    SensingMethod = 2;
    ShutterSpeedValue = "8.219041278295606";
    SubjectArea =     (
        2483,
        33,
        292,
        296
    );
    SubsecTimeDigitized = 269;
    SubsecTimeOriginal = 269;
    WhiteBalance = 0;
}
DPIWidth = 72
Depth = 8
{ExifAux} = {
    Regions =     {
        HeightAppliedTo = 3024;
        RegionList =         (
                        {
                AngleInfoRoll = 270;
                AngleInfoYaw = 270;
                ConfidenceLevel = 99;
                FaceID = 29;
                Height = "0.06024057738572575";
                Timestamp = 2147483647;
                Type = Face;
                Width = "0.07273601924233319";
                X = "0.6160769693325315";
                Y = "0.03012028869286288";
            },
                        {
                AngleInfoRoll = 270;
                AngleInfoYaw = 315;
                ConfidenceLevel = 99;
                FaceID = 30;
                Height = "0.08487570168404171";
                Timestamp = 2147483647;
                Type = Face;
                Width = "0.06303788334335536";
                X = "0.5821334936861094";
                Y = "0.2045292702485966";
            },
                        {
                AngleInfoRoll = 240;
                AngleInfoYaw = 0;
                ConfidenceLevel = 99;
                FaceID = 31;
                Height = "0.07153809141940659";
                Timestamp = 2147483647;
                Type = Face;
                Width = "0.05333974744437764";
                X = "0.4718171978352376";
                Y = "0.8029029671210907";
            }
        );
        WidthAppliedTo = 4032;
    };
}
Orientation = 6
ProfileName = Display P3
{MakerApple} = {
    1 = 9;
    10 = 2;
    12 =     (
        "7.1875",
        "31.75391"
    );
    13 = 38;
    14 = 4;
    16 = 1;
    2 = <8e021002 6c011b02 d7005f00 4402e002 54016a00 36004700 4b003e00 2e002600 a101a201 8801ab01 85005900 3a02cf02 b0005900 95007600 2e002400 2d008300 cc031d02 2101d800 79005b00 1602fe02 4702b200 bd006900 29001600 67008700 17056f02 4901a200 65006d00 60026202 02026000 55003100 3e004500 99009000 43048b01 b201cc00 7d008400 6202f201 c4019500 24022500 46005000 4f004700 3f02af01 0e01cb00 79007e00 54024e03 bb01b400 dc001900 60005500 22001600 5c014d01 6601d700 77007800 68028402 03017700 55002600 25003700 2b001800 6e019f01 4f011701 79007900 d8001501 bd003b00 6c005300 2f002f00 26002600 4902f401 69020d01 89005300 4d01e200 4c005c00 91005700 36002100 1c002c00 8b01ce01 b8014400 5d007900 8c004f00 9a007700 ad003500 29004000 2a001900 bd017c01 32013e00 36006200 7e008f00 62004100 86002400 34004800 26001b00 eb01a101 f8003b00 35003b00 ca010a01 8f007700 7b002c00 33005100 36002e00 5e017501 47013900 34003800 d901d101 7f005200 22001b00 23002000 22002a00 0501d700 b4003800 33003800 a501b300 92005300 20001800 36002500 19001600 fa012201 59003700 33003600 26016f00 cc009600 2d001400 27003100 20001900 f300a300 3f003600 33003500 2a01cc00 d200b700 3f001c00 30002400 1f002000>;
    20 = 3;
    22 = "AR1G+K438OnfHOzqQ+UT5Ix1ijDD";
    23 = 0;
    25 = 2;
    26 = q825s;
    3 =     {
        epoch = 0;
        flags = 1;
        timescale = 1000000000;
        value = 93963587977416;
    };
    31 = 0;
    4 = 1;
    5 = 178;
    6 = 175;
    7 = 1;
    8 =     (
        "-0.02829843",
        "-0.9835473",
        "-0.1944532"
    );
}
{TIFF} = {
    DateTime = "2018:05:05 16:58:33";
    Make = Apple;
    Model = "iPhone 8 Plus";
    Orientation = 6;
    ResolutionUnit = 2;
    Software = "11.3.1";
    XResolution = 72;
    YResolution = 72;
}
ColorModel = RGB
DPIHeight = 72
PixelWidth = 4032
PixelHeight=3024
{Exif}={
光圈值=“1.695993715632365”;
BrightnessValue=“7.553953257086027”;
色彩空间=65535;
组件配置=(
1.
2.
3.
0
);
结果:1=2;
datetimedigidated=“2018:05:05 16:58:33”;
DateTimeOriginal=“2018:05:05 16:58:33”;
DigitalZoomRatio=“1.212510024057739”;
ExifVersion=(
2.
2.
1.
);
ExposureBiasValue=0;
曝光模式=0;
曝光程序=2;
ExposureTime=“0.0033557046986577”;
FNumber=“1.8”;
闪光=24;
FlashPixVersion=(
1.
0
);
焦距35mm胶片=34;
FocalLength=“3.99”;
等速额定值=(
20
);
LensMake=苹果;
LensModel=“iPhone 8 Plus背面双摄像头3.99mm f/1.8”;
透镜规格=(
"3.99",
"6.6",
"1.8",
"2.8"
);
计量模式=5;
像素尺寸=4032;
像素尺寸=3024;
SceneCaptureType=0;
SceneType=1;
传感方法=2;
ShutterSpeedValue=“8.219041278295606”;
主题区域=(
2483,
33,
292,
296
);
亚选区数字化=269;
亚北极原始=269;
白平衡=0;
}
DPIWidth=72
深度=8
{ExifAux}={
地区={
高度应用于=3024;
地区列表=(
{
AngleInfoRoll=270;
偏航角=270;
信心水平=99;
FaceID=29;
Height=“0.06024057738572575”;
时间戳=2147483647;
类型=面;
宽度=“0.07273601924233319”;
X=“0.6160769693325315”;
Y=“0.030120288692888”;
},
{
AngleInfoRoll=270;
偏航角=315;
信心水平=99;
FaceID=30;
高度=“0.08487570168404171”;
时间戳=2147483647;
类型=面;
宽度=“0.06303788334335536”;
X=“0.5821334936894”;
Y=“0.2045292702485966”;
},
{
AngleInfoRoll=240;
角度偏航=0;
信心水平=99;
FaceID=31;
Height=“0.07153809141940659”;
时间戳=2147483647;
类型=面;
宽度=“0.05333974744437764”;
X=“0.4718171978352376”;
Y=“0.8029029671210907”;
}
);
宽度应用到=4032;
};
}
方向=6
ProfileName=显示P3
{MakerApple}={
1 = 9;
10 = 2;
12 =     (
"7.1875",
"31.75391"
);
13 = 38;
14 = 4;
16 = 1;
2 = ;
20 = 3;
22=“AR1G+K438OnfHOzqQ+UT5Ix1ijDD”;
23 = 0;
25 = 2;
26=q825s;
3 =     {
历元=0;
旗帜=1;
时间尺度=100000000;
值=93963587977416;
};
31 = 0;
4 = 1;
5 = 178;
6 = 175;
7 = 1;
8 =     (
"-0.02829843",
"-0.9835473",
"-0.1944532"
);
}
{TIFF}={
DateTime=“2018:05:05 16:58:33”;
制造=苹果;
Model=“iPhone 8 Plus”;
方向=6;
分辨率单位=2;
软件=“11.3.1”;
X分辨率=72;
YResolution=72;
}
颜色模型=RGB
DPIHeight=72
像素宽度=4032

EXIF数据中的特定字段由图像的生产者决定。我不知道“图像唯一Id”本身就是图像的一部分,因此它的存在取决于拍摄照片以添加它的设备。

我认为问题在于您假设EXIF数据中有一个非标准字段。如果你发布了一个图片链接,我们可以检查是否/在哪里存在该字段。谢谢David,我添加了图片链接,当我将该图片加载到网站时,你可以检查。我得到这个:它没有“图片唯一Id”作为字段。奇怪的是,这就是我得到的