Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Extract metadata in Aperture with Automator

The Extract Metadata action doesn't extract all the IPTC fields. Can other fields be added, such as Title?


My goal is to write the Title information to another IPTC field.


I hope the new field can be seen by Photos, but that is unlikely unless there is an EXIF reader for Photos, and I can't see how to search the App Store for just Extensions for Photos.

MacBook Pro with Retina display, iOS 10.2, 16GB, 500GB SSD

Posted on Dec 18, 2016 10:13 PM

Reply
Question marked as Best answer

Experimenting further with AppleScript I found that the Title tag in the Status section of the IPTC data is called "ObjectName".


This script will give a list of all titles:

tell application "Aperture"


activate

set imageSel to (get selection)

if imageSel is {} then

error "Please select an image."

else

set titles to {}

repeat with i from 1 to count of imageSel

tell item i of imageSel

set t to the value of the IPTC tag "ObjectName"

set titles to titles & t

end tell

end repeat

end if

end tell

So you need to add the value of IPTC tag "ObjectName". to the list you have created.

Posted on Dec 19, 2016 11:42 AM

11 replies

Dec 19, 2016 2:27 AM in response to SoCalMtnBiker

Photos on macOS Sierra can read XMP sidecar files. Have you tried to export the originals from Aperture with a sidecar file? File > Export > Original, then select "Metadata: Create IPTC4XMP Sidecar file" as the export preset.


If the sidecar file is present, when you import the exported originals to Photos, the Title field from Aperture (the Title in the Status section of IPTC) will be used as the Title in Photos.

User uploaded file


Alternately, you could batch change your photos in Aperture and write the IPTC metadata into the original image files: In the Batch Change pane check the mark "Apply to original image file". This way, your originals will keep all metadata, even if Photos does not see them all.


I listed an AppleScript in a previous post to create a list of all metadata, but I cannot find it again right now.

Dec 19, 2016 8:13 AM in response to léonie

Thank you for replying. Since posting I started experimenting with a Ruby script that leverages exiftools. I seem to be able to recurse the master images and write new EXIF, and Aperture is OK with that (guessing it reads the master each time and EXIF is not stored anywhere else by Aperture). I'm not quite done, so can't be sure yet. I'm experimenting on a small exported Library. I don't want to export and reimport because my main library has 70,000 photos.


And I would like to be able to read the EXIF data directly from or in Photos. Having to export and then read would be a bit tedious. Maybe I can work out a script to find the file and use exiftools, but can't imagine that looking for one file among 70,000 will be very fast. I guess I could create a database of some sort, but that seems like a bit much.


I also haven't found a way to search for Photos Extensions. I know Apple hasn't figured out search; it doesn't work well on their websites either.

Dec 19, 2016 8:41 AM in response to SoCalMtnBiker

Yes, exiftool will help you to get access to all metadata tags.


I just found my AppleScript again. Aperture is fully scriptable with AppleScript, and you can access all IPTC and EXIF tags.


This script will write all tags to a text file. You can wrap it as an Automator workflow, if you paste the script into a "Run AppleScript" action, prefixed by a "Get Selected Images" action.


(* Write Metadata tags to a file


Author: Leonie Dreschler-Fischer


To run this workflow, select some images in Aperture,

then start the workflow by pressing the "Run Button",

or install the workflow as service in ~/Library/Services and launch it from the Services menu in Aperture,

when prompted, enter a filename for the text output

*)


on write_info(im_version, f)

local nam, w, h, dat, dims, nl

local res

tell application "Aperture"


set dat to ""

set nl to "

"

try

set nam to "Name: "

set nam to "Version Name: " & (get the name of im_version as string)

write nam to f

write nl to f

end try

try

set w to get width of im_version as string

set h to get height of im_version as string

set dims to " Dimensions: " & w & "x" & h & nl

write dims to f

end try

try

tell im_version

set dat to (value of EXIF tag "ImageDate") as string

end tell

set dat to " Image Date: " & dat & nl

write dat to f

end try

try

local thekeywords

tell im_version

set thekeywords to (value of IPTC tag "keywords") as string

end tell

set thekeywords to " Keywords: " & thekeywords & nl

write thekeywords to f

end try

try

local rating, isflagged, ispicked

tell im_version

set rating to get the main rating of im_version as string

set isflagged to get flagged of im_version as string

set ispicked to get picked of im_version as string

end tell

set rating to " Rating: " & rating & ", flagged: " & isflagged & ", picked: " & ispicked & nl

write rating to f

end try


try

local cam_make, cam_model, camera

tell im_version

set cam_make to (value of EXIF tag "Make") as string

set cam_model to (value of EXIF tag "Model") as string

end tell

set camera to " Camera make: " & cam_make & ", camera model: " & cam_model & nl

write camera to f

end try

try -- this does not work, why?

local the_lens, cam_lens

tell im_version

set cam_lens to (value of EXIF tag "LensModel") as string

end tell

set the_lens to " Lens: " & cam_lens & nl

write the_lens to f

end try


try

local focal_length, aperture_value, shutter_speed, capture

tell im_version

set focal_length to (value of EXIF tag "FocalLength") as string

set aperture_value to (value of EXIF tag "ApertureValue") as string

set shutter_speed to (value of EXIF tag "Shutterspeed") as string

end tell

set capture to " Focal Length: " & focal_length & "mm, Aperture: f/ " & aperture_value & ", Shutter Speed: " & shutter_speed & "s" & nl

write capture to f

end try


local gps, thelongitude, thelatitude, theheight


set thelongitude to "Longitude: unknown"

set thelatitude to ", Latitude: unknown"

set thealtitude to ", Altitude: unknown"

try

set thelongitude to "Longitude: " & (get the longitude of im_version as string)

set thelatitude to ", Latitude: " & (get the latitude of im_version as string)

set thealtitude to ", Altitude: " & (get the altitude of im_version as string)

end try

set gps to "GPS: " & thelongitude & thelatitude & thealtitude & nl

write gps to f

return nam

end tell

end write_info


on run {input, parameters}


(* Write EXIF info on all selected images to a file *)


if input is {} then error "Please select an image."


local outputFile, item_count, im, inf

set outputFile to choose file name with prompt "Output File name"

set the inf to ""

try

open for access outputFile with write permission


set the item_count to count of input


repeat with i from 1 to the item_count

set im to item i of input


set inf to write_info(im, outputFile)

end repeat

close access outputFile

tell application "TextEdit"

activate

open outputFile

end tell

end try

return input

end run


User uploaded file

Dec 19, 2016 10:59 AM in response to léonie

@leonie Thank you for the detailed instructions. Not knowing my way around Automator/Script Editor this was useful.

The result

Version Name: 2014.04.06-11.51.48.gs.L Dimensions: 4000x3000 Image Date: Sunday, April 6, 2014 at 6:51:48 PM Rating: 1, flagged: false, picked: true Camera make: Panasonic, camera model: DMC-G2 Lens: LUMIX G VARIO 14-140/F4.0-5.8 Focal Length: 14.0mm, Aperture: f/ 13.0, Shutter Speed: 1.0E-3s GPS: Longitude: missing value, Latitude: missing value, Altitude: unknown

The result from my exiftool Ruby script

photo['DateTimeOriginal']: 2014-04-06 18:51:48 -0700 photo.datetimeoriginal: 2014-04-06 18:51:48 -0700 photo.title: photo.ObjectName: AFAreaMode: Tracking AFAssistLamp: Enabled but Not Used AFPointPosition: 0.33 0.67 AccessorySerialNumber: 0 AccessoryType: NO-ACCESSORY AdvancedSceneMode: Off AdvancedSceneType: 1 Aperture: 13.0 ApplicationRecordVersion: 4 Audio: No BabyAge: (not set) BabyName: BitsPerSample: 8 BlackLevel1: 1 BlackLevel2: 3 BlackLevel3: 12 BlackLevelBlue: 0 BlackLevelGreen: 0 BlackLevelRed: 0 BlueBalance: 1.429658 BracketSettings: No Bracket BurstMode: Off CircleOfConfusion: 0.015 mm ColorComponents: 3 ColorEffect: Off ColorMode: Normal ColorSpace: sRGB ColorTempKelvin: 3300 ComponentsConfiguration: Y, Cb, Cr, - CompressedBitsPerPixel: 2 Compression: JPEG (old-style) Contrast: Normal ContrastMode: Normal ConversionLens: Off CreateDate: 2014-04-06 18:51:48 -0700 CurrentIPTCDigest: fce796d221822372712881cd9375075f CustomRendered: Custom DataDump: (Binary data 6152 bytes, use -b option to extract) DateTimeOriginal: 2014-04-06 18:51:48 -0700 DigitalZoomRatio: 0 DistortionCorrection: On DistortionParam02: 0.0023193359375 DistortionParam04: 0.026763916015625 DistortionParam08: 0.10028076171875 DistortionParam09: 0.000396728515625 DistortionParam11: -0.027496337890625 DistortionScale: 1 EncodingProcess: Baseline DCT, Huffman coding ExifByteOrder: Little-endian (Intel, II) ExifImageHeight: 1440 ExifImageWidth: 1920 ExifToolVersion: 10.05 ExifVersion: 0221 ExposureCompensation: 0 ExposureMode: Auto ExposureProgram: Program AE ExposureTime: 1/1000 FNumber: 13.0 FOV: 65.5 deg FacesDetected: 0 FacesRecognized: 0 FileAccessDate: 2016-12-19 10:43:45 -0800 FileInodeChangeDate: 2016-12-18 23:55:23 -0800 FileModifyDate: 2016-12-18 23:55:23 -0800 FilePermissions: rw-r--r-- FileSize: 14 MB FileSource: Digital Camera FileType: RW2 FileTypeExtension: rw2 FilmMode: Standard (color) FirmwareVersion: 0.1.1.0 Flash: Off, Did not fire FlashBias: 0 FlashCurtain: n/a FlashFired: No FlashpixVersion: 100 FocalLength: 14.0 mm FocalLength35efl: 14.0 mm (35 mm equivalent: 28.0 mm) FocalLengthIn35mmFormat: 28 mm FocusMode: AF-S GainControl: Low gain up HighISOMultiplierBlue: 0 HighISOMultiplierGreen: 0 HighISOMultiplierRed: 0 HyperfocalDistance: 1.00 m ISO: 200 ImageHeight: 3000 ImageQuality: Raw ImageSize: 4000x3000 ImageStabilization: On, Mode 1 ImageWidth: 4000 Instructions: 2014-04-06 18:51:48 UTC. Time zone of photo is GMT -7 IntelligentExposure: Off IntelligentResolution: High InternalSerialNumber: (X04) 2010:05:05 no. 0043 InteropIndex: R98 - DCF basic file (sRGB) InteropVersion: 100 JpgFromRaw: (Binary data 686608 bytes, use -b option to extract) LensFirmwareVersion: 0.1.4.0 LensID: LUMIX G VARIO 14-140mm F4.0-5.8 LensSerialNumber: 9090083294 LensType: LUMIX G VARIO 14-140/F4.0-5.8 LightSource: Fine Weather LightValue: 16.4 LinearityLimitBlue: 3967 LinearityLimitGreen: 3967 LinearityLimitRed: 3967 Location: LongExposureNoiseReduction: On MIMEType: image/x-panasonic-rw2 MacroMode: Off Make: Panasonic MakerNoteVersion: 0136 MaxApertureValue: 4.0 Megapixels: 12.0 MeteringMode: Multi-segment Model: DMC-G2 ModifyDate: 2014-04-06 18:51:48 -0700 NoiseReduction: Low (-1) NumFacePositions: 0 NumWBEntries: 7 OpticalZoomMode: Standard Orientation: Horizontal (normal) PanasonicExifVersion: 330 PanasonicImageHeight: 3000 PanasonicImageWidth: 4000 PanasonicRawVersion: 310 PrintIMVersion: 250 ProgramISO: 200 RawDataOffset: 690964 RedBalance: 1.889734 ResolutionUnit: inches Rotation: Horizontal (normal) RowsPerStrip: 3016 Saturation: Normal ScaleFactor35efl: 2.0 SceneCaptureType: Standard SceneMode: Off SceneType: Directly photographed SelfTimer: Off SensingMethod: One-chip color area SensorBottomBorder: 3004 SensorHeight: 3016 SensorLeftBorder: 8 SensorRightBorder: 4008 SensorTopBorder: 4 SensorWidth: 4060 SequenceNumber: 0 Sharpness: Normal ShootingMode: Program ShutterSpeed: 1/1000 Software: Ver.1.1 Source: P1260367.RW2 StripByteCounts: 0 StripOffsets: 4294967295 TextStamp: Off ThumbnailImage: (Binary data 6378 bytes, use -b option to extract) ThumbnailLength: 6378 ThumbnailOffset: 9838 TimeSincePowerOn: 00:00:08.14 TimeZoneOffset: -7 Title: TravelDay: n/a UsageTerms: 145422 seconds from nearest GPS point WBBlueLevel: 376 WBGreenLevel: 263 WBRedLevel: 497 WBShiftAB: 0 WBShiftGM: 0 WBType1: Fine Weather WBType2: Cloudy WBType3: Shade WBType4: Tungsten (Incandescent) WBType5: Flash WBType6: D55 WBType7: ISO Studio Tungsten WB_RGBLevels1: 482 256 366 WB_RGBLevels2: 518 256 334 WB_RGBLevels3: 570 256 312 WB_RGBLevels4: 330 256 536 WB_RGBLevels5: 575 256 308 WB_RGBLevels6: 453 256 362 WB_RGBLevels7: 330 256 536 WhiteBalance: Daylight WorldTimeLocation: Home XMPToolkit: Image::ExifTool 10.05 XResolution: 180 YCbCrPositioning: Co-sited YCbCrSubSampling: YCbCr4:2:2 (2 1) YResolution: 180

What's missing is Title as it shows in Aperture

User uploaded file

Slightly confusing because Title and Source are now the same (I succeeded in copying Title to Source, but not in copying Caption to Title because I can't identify the Title.)

Dec 19, 2016 11:03 AM in response to SoCalMtnBiker

Sorry the returns went away in the blockquote, my bad


exiftool results again. The first two items are "custom" to try and figure out how to find Title; the rest is the "dump".

photo.title:

photo.ObjectName:


AFAreaMode: Tracking

AFAssistLamp: Enabled but Not Used

AFPointPosition: 0.33 0.67

AccessorySerialNumber: 0

AccessoryType: NO-ACCESSORY

AdvancedSceneMode: Off

AdvancedSceneType: 1

Aperture: 13.0

ApplicationRecordVersion: 4

Audio: No

BabyAge: (not set)

BabyName:

BitsPerSample: 8

BlackLevel1: 1

BlackLevel2: 3

BlackLevel3: 12

BlackLevelBlue: 0

BlackLevelGreen: 0

BlackLevelRed: 0

BlueBalance: 1.429658

BracketSettings: No Bracket

BurstMode: Off

CircleOfConfusion: 0.015 mm

ColorComponents: 3

ColorEffect: Off

ColorMode: Normal

ColorSpace: sRGB

ColorTempKelvin: 3300

ComponentsConfiguration: Y, Cb, Cr, -

CompressedBitsPerPixel: 2

Compression: JPEG (old-style)

Contrast: Normal

ContrastMode: Normal

ConversionLens: Off

CreateDate: 2014-04-06 18:51:48 -0700

CurrentIPTCDigest: fce796d221822372712881cd9375075f

CustomRendered: Custom

DataDump: (Binary data 6152 bytes, use -b option to extract)

DateTimeOriginal: 2014-04-06 18:51:48 -0700

DigitalZoomRatio: 0

DistortionCorrection: On

DistortionParam02: 0.0023193359375

DistortionParam04: 0.026763916015625

DistortionParam08: 0.10028076171875

DistortionParam09: 0.000396728515625

DistortionParam11: -0.027496337890625

DistortionScale: 1

EncodingProcess: Baseline DCT, Huffman coding

ExifByteOrder: Little-endian (Intel, II)

ExifImageHeight: 1440

ExifImageWidth: 1920

ExifToolVersion: 10.05

ExifVersion: 0221

ExposureCompensation: 0

ExposureMode: Auto

ExposureProgram: Program AE

ExposureTime: 1/1000

FNumber: 13.0

FOV: 65.5 deg

FacesDetected: 0

FacesRecognized: 0

FileAccessDate: 2016-12-19 10:43:45 -0800

FileInodeChangeDate: 2016-12-18 23:55:23 -0800

FileModifyDate: 2016-12-18 23:55:23 -0800

FilePermissions: rw-r--r--

FileSize: 14 MB

FileSource: Digital Camera

FileType: RW2

FileTypeExtension: rw2

FilmMode: Standard (color)

FirmwareVersion: 0.1.1.0

Flash: Off, Did not fire

FlashBias: 0

FlashCurtain: n/a

FlashFired: No

FlashpixVersion: 100

FocalLength: 14.0 mm

FocalLength35efl: 14.0 mm (35 mm equivalent: 28.0 mm)

FocalLengthIn35mmFormat: 28 mm

FocusMode: AF-S

GainControl: Low gain up

HighISOMultiplierBlue: 0

HighISOMultiplierGreen: 0

HighISOMultiplierRed: 0

HyperfocalDistance: 1.00 m

ISO: 200

ImageHeight: 3000

ImageQuality: Raw

ImageSize: 4000x3000

ImageStabilization: On, Mode 1

ImageWidth: 4000

Instructions: 2014-04-06 18:51:48 UTC. Time zone of photo is GMT -7

IntelligentExposure: Off

IntelligentResolution: High

InternalSerialNumber: (X04) 2010:05:05 no. 0043

InteropIndex: R98 - DCF basic file (sRGB)

InteropVersion: 100

JpgFromRaw: (Binary data 686608 bytes, use -b option to extract)

LensFirmwareVersion: 0.1.4.0

LensID: LUMIX G VARIO 14-140mm F4.0-5.8

LensSerialNumber: 9090083294

LensType: LUMIX G VARIO 14-140/F4.0-5.8

LightSource: Fine Weather

LightValue: 16.4

LinearityLimitBlue: 3967

LinearityLimitGreen: 3967

LinearityLimitRed: 3967

Location:

LongExposureNoiseReduction: On

MIMEType: image/x-panasonic-rw2

MacroMode: Off

Make: Panasonic

MakerNoteVersion: 0136

MaxApertureValue: 4.0

Megapixels: 12.0

MeteringMode: Multi-segment

Model: DMC-G2

ModifyDate: 2014-04-06 18:51:48 -0700

NoiseReduction: Low (-1)

NumFacePositions: 0

NumWBEntries: 7

OpticalZoomMode: Standard

Orientation: Horizontal (normal)

PanasonicExifVersion: 330

PanasonicImageHeight: 3000

PanasonicImageWidth: 4000

PanasonicRawVersion: 310

PrintIMVersion: 250

ProgramISO: 200

RawDataOffset: 690964

RedBalance: 1.889734

ResolutionUnit: inches

Rotation: Horizontal (normal)

RowsPerStrip: 3016

Saturation: Normal

ScaleFactor35efl: 2.0

SceneCaptureType: Standard

SceneMode: Off

SceneType: Directly photographed

SelfTimer: Off

SensingMethod: One-chip color area

SensorBottomBorder: 3004

SensorHeight: 3016

SensorLeftBorder: 8

SensorRightBorder: 4008

SensorTopBorder: 4

SensorWidth: 4060

SequenceNumber: 0

Sharpness: Normal

ShootingMode: Program

ShutterSpeed: 1/1000

Software: Ver.1.1

Source: P1260367.RW2

StripByteCounts: 0

StripOffsets: 4294967295

TextStamp: Off

ThumbnailImage: (Binary data 6378 bytes, use -b option to extract)

ThumbnailLength: 6378

ThumbnailOffset: 9838

TimeSincePowerOn: 00:00:08.14

TimeZoneOffset: -7

Title:

TravelDay: n/a

UsageTerms: 145422 seconds from nearest GPS point

WBBlueLevel: 376

WBGreenLevel: 263

WBRedLevel: 497

WBShiftAB: 0

WBShiftGM: 0

WBType1: Fine Weather

WBType2: Cloudy

WBType3: Shade

WBType4: Tungsten (Incandescent)

WBType5: Flash

WBType6: D55

WBType7: ISO Studio Tungsten

WB_RGBLevels1: 482 256 366

WB_RGBLevels2: 518 256 334

WB_RGBLevels3: 570 256 312

WB_RGBLevels4: 330 256 536

WB_RGBLevels5: 575 256 308

WB_RGBLevels6: 453 256 362

WB_RGBLevels7: 330 256 536

WhiteBalance: Daylight

WorldTimeLocation: Home

XMPToolkit: Image::ExifTool 10.05

XResolution: 180

YCbCrPositioning: Co-sited

YCbCrSubSampling: YCbCr4:2:2 (2 1)

YResolution: 180

======

P1260367.RW2 should appear twice as it does in the screenshot.

Question marked as Best answer

Dec 19, 2016 11:42 AM in response to SoCalMtnBiker

Experimenting further with AppleScript I found that the Title tag in the Status section of the IPTC data is called "ObjectName".


This script will give a list of all titles:

tell application "Aperture"


activate

set imageSel to (get selection)

if imageSel is {} then

error "Please select an image."

else

set titles to {}

repeat with i from 1 to count of imageSel

tell item i of imageSel

set t to the value of the IPTC tag "ObjectName"

set titles to titles & t

end tell

end repeat

end if

end tell

So you need to add the value of IPTC tag "ObjectName". to the list you have created.

Dec 19, 2016 12:17 PM in response to léonie

@leonie. That's what I thought and if you look at my output, that is supposed to be the the second item (photo.ObjectName). I've tried it with and without caps. Guess I need to explore exiftools a bit more. AppleScript and I just don't get along. That's why I'm using Ruby. I could never figure out the syntax. But your script works, so shouldn't be too hard except it doesn't show up in the complete list.


Thank you. This confirms I was looking in the right place.

Dec 19, 2016 12:33 PM in response to SoCalMtnBiker

Oddly Title/ObjectName doesn't show up if look at the IPTC in Preview. Source does. User uploaded file

Since the thread has gone a bit. This is the master image in the Aperture Library. I assumed that the master image is the one I imported, but the screenshot below shows the photo that is stored in the Previews folder in the Library. Onion Valley 2015 Test.aplibrary/Previews/2014/04/07/20140407-110535/slT+bBdUQtyAxmdW+aCTNQ/2014. 04.06-11.51.48.gs.L.jpg

User uploaded file

Curious. Much to learn. But this may be enough information for me to do what I want. I'm also going to try writing directly to ObjectName/Title. exiftool shows this info too.

Extract metadata in Aperture with Automator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.