iOS如何获取exif,markernote数据

How iOS how to get exif, markernote data

提问人:user7939590 提问时间:10/30/2023 最后编辑:user7939590 更新时间:11/5/2023 访问量:45

问:

我用iOS声音方法读取这些数据,但是我发现这些数据都是一些常规数据,然后新数据是正确的,比如重测特定的数据我看不懂,不知道从哪里得到!

我尝试使用 image/io

static public func getImageInfo(url: URL) {
    if let imageSource = CGImageSourceCreateWithURL(url as CFURL, nil) {
        if let MetadataProperties = CGImageSourceCopyMetadataAtIndex(imageSource, 0, nil) as? [String: Any] {
            print("All Image Metadata: \(MetadataProperties)")
            print("All Image Metadata: \(MetadataProperties)")
        }
        
        
        let imageCount = CGImageSourceGetCount(imageSource)
        print("Image Count: \(imageCount)")
        
        for i in 0..<imageCount {
            if let properties = CGImageSourceCopyPropertiesAtIndex(imageSource, i, nil) as? [CFString: Any] {
                print("Properties of image at index \(i): \(properties)")
            }
        }
        
        if let properties2 = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil) as? [CFString: Any],
           let makerNote = properties2[kCGImagePropertyMakerAppleDictionary] as? Any {
            print("Maker Note: \(makerNote)")
            print("Maker Note: \(makerNote)")
        }
    }
}

但是我想要一些适用于 iOS 的特殊数据。例如,索尼富士相机的照片模式。JPEG格式。

因为 iOS 似乎没有它。exiftool 或 exifv2

这是正常数据。

{
  "{Exif}" : {
    "ApertureValue" : 2.6000000000000001,
    "BodySerialNumber" : "3T102913",
    "BrightnessValue" : 0.050000000000000003,
    "ColorSpace" : 1,
    "ComponentsConfiguration" : [
      1,
      2,
      3,
      0
    ],
    "CompositeImage" : 1,
    "CompressedBitsPerPixel" : 4.7999999999999998,
    "CustomRendered" : 0,
    "DateTimeDigitized" : "2023:10:29 20:28:42",
    "DateTimeOriginal" : "2023:10:29 20:28:42",
    "ExifVersion" : [
      2,
      3,
      2
    ],
    "ExposureBiasValue" : -1,
    "ExposureMode" : 0,
    "ExposureProgram" : 2,
    "ExposureTime" : 0.0028571428571428571,
    "FileSource" : 3,
    "Flash" : 0,
    "FlashPixVersion" : [
      1,
      0
    ],
    "FNumber" : 2.5,
    "FocalLength" : 27,
    "FocalLenIn35mmFilm" : 41,
    "FocalPlaneResolutionUnit" : 3,
    "FocalPlaneXResolution" : 2660,
    "FocalPlaneYResolution" : 2660,
    "ISOSpeedRatings" : [
      5000
    ],
    "LensMake" : "VILTROX ",
    "LensModel" : "AF 27\/1.2 XF      ",
    "LensSerialNumber" : "00000000",
    "LensSpecification" : [
      27,
      27,
      1.2000000476837158,
      1.2000000476837158
    ],
    "LightSource" : 0,
    "MaxApertureValue" : 0.5,
    "MeteringMode" : 5,
    "OffsetTime" : "+08:00",
    "OffsetTimeDigitized" : "+08:00",
    "OffsetTimeOriginal" : "+08:00",
    "PixelXDimension" : 6240,
    "PixelYDimension" : 3512,
    "SceneCaptureType" : 0,
    "SceneType" : 1,
    "SensingMethod" : 2,
    "SensitivityType" : 1,
    "Sharpness" : 1,
    "ShutterSpeedValue" : 8.5099999999999998,
    "SubjectDistRange" : 0,
    "WhiteBalance" : 0
  },
  "{ExifAux}" : {
    "AFInfo" : [
      0.40544870495796204,
      0.59866172075271606,
      0.05000000074505806,
      0.049829158931970596,
      "f"
    ],
    "FocusMode" : 1,
    "LensInfo" : [
      27,
      27,
      1.2,
      1.2
    ],
    "LensModel" : "27.0 mm f\/1.2"
  },
  "{IPTC}" : {
    "Byline" : [
      "DG                                                                                                                                                                                                                                                             "
    ],
    "CopyrightNotice" : "                                                                                                                                                                                                                                                               ",
    "StarRating" : 0
  },
  "{PictureStyle}" : {
    "Contrast" : [
      "Normal",
      0,
      0
    ],
    "FilmSimulation" : [
      "1536",
      1536,
      1536
    ],
    "Monochrome" : [
      "0",
      0,
      0
    ],
    "PictStyleColorSpace" : [
      "sRGB",
      1,
      1
    ],
    "PictureStyle" : [
      "Program AE",
      6,
      6
    ],
    "Saturation" : [
      "Medium Low",
      384,
      -1
    ],
    "Sharpness" : [
      "Soft2",
      2,
      -3
    ]
  },
  "{TIFF}" : {
    "Artist" : "DG                                                                                                                                                                                                                                                             ",
    "Copyright" : "                                                                                                                                                                                                                                                               ",
    "DateTime" : "2023:10:29 20:28:42",
    "Make" : "FUJIFILM",
    "Model" : "X-S20",
    "Orientation" : 1,
    "ResolutionUnit" : 2,
    "Software" : "Digital Camera X-S20 Ver1.10",
    "XResolution" : 72,
    "YResolution" : 72
  },
  "ColorModel" : "RGB",
  "Depth" : 8,
  "DPIHeight" : 72,
  "DPIWidth" : 72,
  "Orientation" : 1,
  "PixelHeight" : 3512,
  "PixelWidth" : 6240,
  "ProfileName" : "sRGB IEC61966-2.1"
}

但我想要一些像邵,heightlight。

0x1001
Sharpness
0x0 = -4 (softest)
0x1 = -3 (very soft)
0x2 = -2 (soft)
0x3 = 0 (normal)
0x4 = +2 (hard)
0x5 = +3 (very hard)
0x6 = +4 (hardest)
0x82 = -1 (medium soft)
0x84 = +1 (medium hard)
0x8000 = Film Simulation
0xffff = n/a
WhiteBalance
0x0 = Auto
0x1 = Auto (white priority)
0x2 = Auto (ambiance priority)
0x100 = Daylight
0x200 = Cloudy
0x300 = Daylight Fluorescent
0x301 = Day White Fluorescent
0x302 = White Fluorescent
0x303 = Warm White Fluorescent
0x304 = Living Room Warm White Fluorescent
0x400 = Incandescent
0x500 = Flash
0x600 = Underwater
0xf00 = Custom
0xf01 = Custom2
0xf02 = Custom3
0xf03 = Custom4
0xf04 = Custom5
0xff0 = Kelvin
Saturation

0x0 = Normal
0x80 = Medium High
0x100 = High
0x180 = Medium Low
0x200 = Low
0x8000 = Film Simulation
NoiseReduction 
0x0 = 0 (normal)
0x100 = +2 (strong)
0x180 = +1 (medium strong)
0x1c0 = +3 (very strong)
0x1e0 = +4 (strongest)
0x200 = -2 (weak)
0x280 = -1 (medium weak)
0x2c0 = -3 (very weak)
0x2e0 = -4 (weakest)

我要补充一点,我想访问富士胶片的一些特殊标记笔记数据,例如这些数据,它们在 iOS 中没有提供,但我可以在 exiftool 中找出它们;我不能在 iOS 上使用 exiftool,那么有什么好方法可以做到这一点吗?

iOS Swift 镜像 Exif

评论

0赞 Joakim Danielson 10/30/2023
理解这个问题并不容易,但你的意思是这样的吗?kCGImagePropertyMakerFujiDictionary
0赞 soundflix 10/30/2023
编辑您的问题,并更清楚地了解您已经获得了哪些元数据属性,以及您正在尝试获取哪些元数据属性。
0赞 soundflix 10/30/2023
ExifTool 确实做出了巨大努力,以标准化的、人类可读的格式输出来自不同制造商的元数据。在 iOS 中,您可能不会那么容易。
0赞 soundflix 10/30/2023
这可能有助于从字典中读取单个属性: stackoverflow.com/a/34254148/16157878
0赞 soundflix 10/30/2023
“Shaow,heightlight”是什么意思?

答: 暂无答案