LoginSignup
4
4

More than 5 years have passed since last update.

flickrのExif情報とiOSのExif定数を紐付ける

Posted at

Flickr APIを使って、写真のGPS情報を取得するには「flickr.photos.getExif」APIを使います。

flickr.photos.getExifからのレスポンス
<rsp stat="ok">
  <photo id="12499156243" secret="170c8d62c6" server="7419" farm="8" camera="Apple iPhone 5s">
    <exif tagspace="IFD0" tagspaceid="0" tag="Make" label="Make">
      <raw>Apple</raw>
    </exif>
    <exif tagspace="IFD0" tagspaceid="0" tag="Model" label="Model">
      <raw>iPhone 5s</raw>
    </exif>
    <exif tagspace="IFD0" tagspaceid="0" tag="Orientation" label="Orientation">
      <raw>Rotate 90 CW</raw>
    </exif>
       ・
       ・
       ・
  </photo>
</rsp>

このExif情報を使ってアプリ側で何かしたい場合は、
上記のflickrから返ってくるレスポンスとiOS側でExifを扱う定数を紐付ける必要があります。

以下は、その一部です。
Exif情報を取得した写真はiPhone5Sで撮影したものです。
撮影したカメラや撮影時の環境でレスポンスの内容は変わります。

flickr(tagspace) flickr(tag) flickr(label) iOS
IFD0 Make Make kCGImagePropertyTIFFMake
IFD0 Model Model kCGImagePropertyTIFFModel
IFD0 Orientation Orientation kCGImagePropertyTIFFOrientation
IFD0 XResolution X-Resolution kCGImagePropertyTIFFXResolution
IFD0 YResolution Y-Resolution kCGImagePropertyTIFFYResolution
IFD0 ResolutionUnit ResolutionUnit kCGImagePropertyTIFFResolutionUnit
IFD0 Software Software kCGImagePropertyTIFFSoftware
IFD0 ModifyDate Date and Time (Modified) kCGImagePropertyTIFFDateTime
IFD0 YCbCrPositioning YCbCr Positioning ?
IFD1 Compression Compression kCGImagePropertyTIFFCompression
IFD1 ResolutionUnit Resolution Unit kCGImagePropertyTIFFResolutionUnit
IFD1 ThumbnailOffset Thumbnail Offset ?
IFD1 ThumbnailLength Thumbnail Length ?
ExifIFD ExposureTime Exposure kCGImagePropertyExifExposureTime
ExifIFD FNumber Aperture kCGImagePropertyExifFNumber
ExifIFD ExposureProgram ExposureProgram kCGImagePropertyExifExposureProgram
ExifIFD ISO ISO Speed kCGImagePropertyExifISOSpeedRatings
ExifIFD ExifVersion Exif Version kCGImagePropertyExifVersion
ExifIFD DateTimeOriginal Date and Time (Original) kCGImagePropertyExifDateTimeOriginal
ExifIFD CreateDate Date and Time (Digitized) kCGImagePropertyExifDateTimeDigitized
ExifIFD ComponentsConfiguration Components Configuration kCGImagePropertyExifComponentsConfiguration
ExifIFD BrightnessValue Brightness Value kCGImagePropertyExifBrightnessValue
ExifIFD MeteringMode Metering Mode kCGImagePropertyExifMeteringMode
ExifIFD Flash Flash kCGImagePropertyExifFlash
ExifIFD FocalLength Focal Length kCGImagePropertyExifFocalLength
ExifIFD SubjectArea Subject Area kCGImagePropertyExifSubjectArea
ExifIFD SubSecTimeOriginal Sub Sec Time Original kCGImagePropertyExifSubsecTimeOrginal
ExifIFD SubSecTimeDigitized Sub Sec Time Digitized kCGImagePropertyExifSubsecTime or kCGImagePropertyExifSubsecTimeDigitized
ExifIFD FlashpixVersion Flashpix Version kCGImagePropertyExifFlashPixVersion
ExifIFD ColorSpace Color Space kCGImagePropertyExifColorSpace
ExifIFD SensingMethod Sensing Method kCGImagePropertyExifSensingMethod
ExifIFD SceneType Scene Type kCGImagePropertyExifSceneType
ExifIFD ExposureMode Exposure Mode kCGImagePropertyExifExposureMode
ExifIFD WhiteBalance White Balance kCGImagePropertyExifWhiteBalance
ExifIFD DigitalZoomRatio Digital Zoom Ratio kCGImagePropertyExifDigitalZoomRatio
ExifIFD FocalLengthIn35mmFormat Focal Length (35mm format) kCGImagePropertyExifFocalLenIn35mmFilm
ExifIFD SceneCaptureType Scene Capture Type kCGImagePropertyExifSceneCaptureType
ExifIFD LensInfo Lens Info kCGImagePropertyExifLensSpecification
ExifIFD LensMake Lens Make kCGImagePropertyExifLensMake
ExifIFD LensModel Lens Model kCGImagePropertyExifLensModel
GPS GPSLatitudeRef GPS Latitude Ref kCGImagePropertyGPSLatitudeRef
GPS GPSLatitude GPS Latitude kCGImagePropertyGPSLatitude
GPS GPSLongitudeRef GPS Longitude Ref kCGImagePropertyGPSLongitudeRef
GPS GPSLongitude GPS Longitude kCGImagePropertyGPSLongitude
GPS GPSAltitudeRef GPS Altitude Ref kCGImagePropertyGPSAltitudeRef
GPS GPSAltitude GPS Altitude kCGImagePropertyGPSAltitude
GPS GPSTimeStamp GPS Time Stamp kCGImagePropertyGPSTimeStamp
GPS GPSImgDirectionRef GPS Img Direction Ref kCGImagePropertyGPSImgDirectionRef
GPS GPSImgDirection GPS Img Direction kCGImagePropertyGPSImgDirection
GPS GPSImgDirection GPS Img Direction kCGImagePropertyGPSImgDirection
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4