Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Integrating with the
Photography Ecosystem
     on Mac OS X
The Ecosystem
The Ecosystem




    Image Capture
The Ecosystem



      Image IO



    Image Capture
The Ecosystem

Image Kit    Quicktime      Core Image



              Image IO



            Image Capture
The Ecosystem
 iPhoto       Aperture      Your App!



Image Kit    Quicktime      Core Image



              Image IO


...
Today
 iPhoto       Aperture      Your App!



Image Kit    Quicktime      Core Image



              Image IO



       ...
No Private APIs




    Photo: Trey Ratcliff/Flickr
RAW
Photo: Flickr user Svet
• Sensor data + decision data




                         Photo: Flickr user Svet
• Sensor data + decision data
• No processing in-camera




                         Photo: Flickr user Svet
• Sensor data + decision data
• No processing in-camera
• No compression




                         Photo: Flickr user S...
• Sensor data + decision data
• No processing in-camera
• No compression
• Big Files




                         Photo: F...
• Sensor data + decision data
• No processing in-camera
• No compression
• Big Files
• Every camera needs specific
   suppo...
Photographers who
spend money on their
  craft shoot RAW.
Photographers who will
 buy your application
     shoot RAW.
Do not assume you can
 pretend that RAW
    doesn’t exist.
That said, you do not
  want to be on the
 treadmill of directly
   supporting RAW
       formats.
Even Apple struggles
     with that.
Let Lightroom,
Aperture or iPhoto
     handle it
Photography Workflow


Ingest   Metadata   Edit   Output
Workflow

            • Image Capture
            •
Ingest        Aperture

            • Lightroom
            • iPhoto
Workflow


Ingest   Metadata   Edit   Output
Workflow

             • Title
             •
Metadata       Captions

             • Copyright
             • Keywords
Metadata is a lot of
           effort: respect that
Metadata

                  effort.
GPS Metadata
           workflow still
Metadata

              sucks.
Temporary
Metadata
            problem.
One day, all cameras
            will write geodata
Metadata

                  to EXIF.
Workflow


Ingest   Metadata   Edit   Output
Workflow

       •   Photoshop: pixel editing

       •
Edit       iPhoto: Master + single Version

       •   Aperture: Ma...
Master File
(usually RAW)
Default




  Core
 Image
 Recipe




            Master File
          (usually RAW)
Default   Exposure




  Core       Core
 Image      Image
 Recipe     Recipe




             Master File
           (usu...
Default   Exposure    B &W




  Core       Core           Core
 Image      Image          Image
 Recipe     Recipe       ...
Default   Exposure    B &W          Crop




  Core       Core           Core     Core
 Image      Image          Image   ...
{CI Recipe}
{CI Recipe}
{Image Record}




                               {CI Recipe}
{CI Recipe}
{Image Record}




                               {CI Recipe}
{CI Recipe}
What exists and when?

• Master file exists, but may be offline.
• A JPEG preview may exist.
• CI recipes exist in Aperture ...
Preview generation is a
      preference
Workflow


Ingest   Metadata   Edit   Output
Workflow


Output
Workflow
         •   Version Export to disk


Output
Workflow
         •   Version Export to disk

         •   Media Browser
Output
Workflow
         •   Version Export to disk

         •   Media Browser
Output
         •   Drag & Drop previews out of Ap...
Workflow
         •   Version Export to disk

         •   Media Browser
Output
         •   Drag & Drop previews out of Ap...
Media Browser
Media Browser

       •   No API for Apple’s Media
           Browser
Media Browser

       •   No API for Apple’s Media
           Browser

       •   Check out Karelia’s iMedia
           Br...
Preview Fingerprint
Preview Fingerprint
Aperture writes its internal ID to the IPTC
     Special Instructions in previews.
Preview Fingerprint
Aperture writes its internal ID to the IPTC
     Special Instructions in previews.

 mRG3bpEnT0GOSJ9qN...
Preview Fingerprint
Aperture writes its internal ID to the IPTC
     Special Instructions in previews.

 mRG3bpEnT0GOSJ9qN...
The Ecosystem
 iPhoto       Aperture      Your App!



Image Kit    Quicktime      Core Image



              Image IO


...
Image IO
 iPhoto         Aperture      Your App!



Image Kit      Quicktime      Core Image



                Image IO

...
Your interface to RAW
Your interface to EXIF
      and IPTC
Your interface to
thumbnail generation
Part of
ApplicationServices
   framework
CGImageSource
CGImageSource

• CGImageSourceCreateWithURL()
CGImageSource

• CGImageSourceCreateWithURL()
• CGImageSourceCopyPropertiesAtIndex()
CGImageSource

• CGImageSourceCreateWithURL()
• CGImageSourceCopyPropertiesAtIndex()
• CGImageSourceCreateImageAtIndex()
CGImageSource

• CGImageSourceCreateWithURL()
• CGImageSourceCopyPropertiesAtIndex()
• CGImageSourceCreateImageAtIndex()
•...
CGImageSourceCopyPropertiesAtIndex()



• Returns a dictionary of key/value pairs
  representing image metadata.
• EXIF, I...
High-level dictionaries
           kCGImageProperty{*}Dictionary

•                           •
    TIFF                  ...
EXIF Keys

• kCGImagePropertyExifExposureTime
• kCGImagePropertyExifFNumber
• kCGImagePropertyExifExposureProgram
• kCGIma...
GPS Keys
• kCGImagePropertyGPSLatitude
• kCGImagePropertyGPSLongitude
• kCGImagePropertyGPSAltitude
• kCGImagePropertyGPST...
#1 ImageIO Gotcha:
nothing is guaranteed.
Do not assume the
existence of any key in
    this dictionary.
After all, cameras come
    from hardware
manufacturers and they
never support anything
   entirely correctly.
CGImageSourceCreateImageAtIndex()


• Creates a CGImageRef from an image in
  the file.
• Most image files have one image, b...
CGImageSourceCreateThumbnailAtIndex()



 • Creates a thumbnail from an index
 • Control thumbnail size with the options
 ...
#2 ImageIO Gotcha:
can’t write RAW files.
This is not your
nibware geotagging API.
The Ecosystem
 iPhoto       Aperture      Your App!



Image Kit    Quicktime      Core Image



              Image IO


...
Image Kit
 iPhoto         Aperture      Your App!



Image Kit      Quicktime      Core Image



                Image IO
...
Image Kit: iPhoto in a box
Image Kit: iPhoto in a box

     IKImageBrowserView
        IKImageView
         IKSlideshow
       IKImageEditPanel
IKImageBrowserView
IKImageBrowserView
IKImageBrowserView
     provides:
IKImageBrowserView
     provides:
• Fast, scalable, memory-efficient thumbnail
  view.
IKImageBrowserView
     provides:
• Fast, scalable, memory-efficient thumbnail
  view.
• Zooming
IKImageBrowserView
     provides:
• Fast, scalable, memory-efficient thumbnail
  view.
• Zooming
• Selection
IKImageBrowserView
     provides:
• Fast, scalable, memory-efficient thumbnail
  view.
• Zooming
• Selection
• Grouping (iP...
IKGroupDisclosureStyle




  iPhoto: Thumbnails
IKGroupDisclosureStyle




  iPhoto: Thumbnails
IKGroupDisclosureStyle




  iPhoto: Thumbnails
IKGroupBezelStyle




 Aperture: Stacks
IKGroupBezelStyle




 Aperture: Stacks
IKGroupBezelStyle




 Aperture: Stacks
IKImageBrowserDataSource
IKImageBrowserDataSource

• Required:
IKImageBrowserDataSource

• Required:
 • -numberOfItemsInImageBrowser:
IKImageBrowserDataSource

• Required:
 • -numberOfItemsInImageBrowser:
 • -imageBrowser:itemAtIndex:
IKImageBrowserDataSource

• Required:
 • -numberOfItemsInImageBrowser:
 • -imageBrowser:itemAtIndex:
   • Returned item mu...
IKImageBrowserItem

• Required:
 • - (NSString *) imageUID
 • - (NSString *) imageRepresentationType
   • Constants for su...
IKImageBrowser{*}RepresentationType

 •                   •
     Path                QTMovie

 •                   •
     ...
IKImageBrowserDataSource
IKImageBrowserDataSource
• Optional:
IKImageBrowserDataSource
• Optional:
• -numberOfGroupsInImageBrowser:
IKImageBrowserDataSource
• Optional:
• -numberOfGroupsInImageBrowser:
• -(NSDictionary *)imageBrowser:groupAtIndex:
IKImageBrowserDataSource
• Optional:
• -numberOfGroupsInImageBrowser:
• -(NSDictionary *)imageBrowser:groupAtIndex:
 • IKI...
IKImageBrowserDataSource
• Optional:
• -numberOfGroupsInImageBrowser:
• -(NSDictionary *)imageBrowser:groupAtIndex:
 • IKI...
IKImageBrowserDataSource
• Optional:
• -numberOfGroupsInImageBrowser:
• -(NSDictionary *)imageBrowser:groupAtIndex:
 • IKI...
IKImageBrowserDataSource
• Optional:
• -numberOfGroupsInImageBrowser:
• -(NSDictionary *)imageBrowser:groupAtIndex:
 • IKI...
NSMakeRange(0,4)
NSMakeRange(0,4)



NSMakeRange(4,2)
NSMakeRange(0,4)



NSMakeRange(4,2)   NSMakeRange(6,2)
NSMakeRange(0,4)



NSMakeRange(4,2)   NSMakeRange(6,2)



    NSMakeRange(8,3)
Two Gotchas
Two Gotchas

• Constants for
  IKImageBrowserGroupStyleKey are defined
  in an enum, so pack them in NSNumber.
Two Gotchas

• Constants for
  IKImageBrowserGroupStyleKey are defined
  in an enum, so pack them in NSNumber.
• IKImageBro...
IKImageView
• Rotate
• Zoom
• Crop
• Drag & Drop
• Quite hard to customise for additional
  functionality
IKImageEditPanel
IKImageEditPanel
IKImageEditPanel
IKImageEditPanel
IKSlideshow
IKSlideshow
• Think: Quick Look slideshow in Finder.
IKSlideshow
• Think: Quick Look slideshow in Finder.
• IKSlideshowDataSource:
IKSlideshow
• Think: Quick Look slideshow in Finder.
• IKSlideshowDataSource:
 • -numberOfSlideshowItems
IKSlideshow
• Think: Quick Look slideshow in Finder.
• IKSlideshowDataSource:
 • -numberOfSlideshowItems
 • -slideshowItem...
IKSlideshow
• Think: Quick Look slideshow in Finder.
• IKSlideshowDataSource:
 • -numberOfSlideshowItems
 • -slideshowItem...
IKSlideshow
• Think: Quick Look slideshow in Finder.
• IKSlideshowDataSource:
 • -numberOfSlideshowItems
 • -slideshowItem...
IKSlideshow items
IKSlideshow items
• No interface to implement, just return:
IKSlideshow items
• No interface to implement, just return:
 • NSImage
IKSlideshow items
• No interface to implement, just return:
 • NSImage
 • NSString (a path)
IKSlideshow items
• No interface to implement, just return:
 • NSImage
 • NSString (a path)
 • NSURL
IKSlideshow items
• No interface to implement, just return:
 • NSImage
 • NSString (a path)
 • NSURL
 • NSFileWrapper
IKSlideshow items
• No interface to implement, just return:
 • NSImage
 • NSString (a path)
 • NSURL
 • NSFileWrapper
 • C...
IKSlideshow items
• No interface to implement, just return:
 • NSImage
 • NSString (a path)
 • NSURL
 • NSFileWrapper
 • C...
The Ecosystem
 iPhoto       Aperture      Your App!



Image Kit    Quicktime      Core Image



              Image IO


...
Aperture
 iPhoto         Aperture      Your App!



Image Kit      Quicktime      Core Image



                Image IO

...
Export Plugins
Export Plugins
• Primary method of getting data from
  Aperture and iPhoto.
Export Plugins
• Primary method of getting data from
  Aperture and iPhoto.
• ObjC API-level access to Aperture
Export Plugins
• Primary method of getting data from
  Aperture and iPhoto.
• ObjC API-level access to Aperture
• Focus on...
Export Plugins
• Primary method of getting data from
  Aperture and iPhoto.
• ObjC API-level access to Aperture
• Focus on...
Process


Select   Export     Plugin UI   Rendering   Post-Export
Rendering
MyPlugin                                 ApertureExportManager



             -exportManagerShouldBeginExport

...
Rendering
MyPlugin                              ApertureExportManager



      exportManagerShouldWriteImageData:
        ...
Process: Post-Export


Post-Export
Process: Post-Export
              • Upload the images to the web
                • FlickrExport does all its upload
     ...
Process: Post-Export
              • Upload the images to the web
                • FlickrExport does all its upload
     ...
Process: Post-Export
              • Upload the images to the web
                • FlickrExport does all its upload
     ...
Process: Post-Export
              • Upload the images to the web
                • FlickrExport does all its upload
     ...
Aperture Metadata

• - addKeywords:toImageAtIndex:
• - addHierarchicalKeywords:toImageAtIndex:
• - addCustomMetadataKeyVal...
Hierarchical Keywords




Events > Conferences > C4[2] > Craig Hockenberry
addKeywords:
toImageAtIndex:
addKeywords:
     toImageAtIndex:
• Be careful: all keywords become top-level
  keywords in Aperture’s hierarchy,
addKeywords:
     toImageAtIndex:
• Be careful: all keywords become top-level
  keywords in Aperture’s hierarchy,
• Mess
addKeywords:
     toImageAtIndex:
• Be careful: all keywords become top-level
  keywords in Aperture’s hierarchy,
• Mess
•...
-addHierarchicalKeywords:
    toImageAtIndex:
NSArray *kwdOne = [NSArray arrayWithObjects:
    @”Foo”,
    @”Bar”,
    @”B...
-addHierarchicalKeywords:
    toImageAtIndex:
NSArray *kwdOne = [NSArray arrayWithObjects:
    @”Foo”,                Leaf...
-addHierarchicalKeywords:
    toImageAtIndex:
NSArray *kwdOne = [NSArray arrayWithObjects:
    @”Foo”,                Leaf...
-addHierarchicalKeywords:
    toImageAtIndex:
NSArray *kwdOne = [NSArray arrayWithObjects:
    @”Foo”,                Leaf...
addCustomMetadataKeyValues:
      toImageAtIndex:

• Arbitrary dictionary of key/value pairs
• Must be NSStrings
• Appear ...
FlickrExport Example
• FlickrExport writes back:
 • Flickr ID
 • Flickr URL
• Knowing the Flickr ID of a version in
  Aper...
Custom metadata




Custom
                       Value
 Key
[“Flickr ID” length] != 0
rating >= 3 &&
[“Flickr ID” length] == 0
iPhoto Limitations

• Can’t add metadata back to iPhoto
• Can’t create new keywords
• API has different method names, but
...
Thank You

• fraser@speirs.org
• @fraserspeirs
• http://speirs.org
• http://connectedflow.com
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Integrating with the Photography Ecosystem on Mac OS X
Upcoming SlideShare
Loading in …5
×

Integrating with the Photography Ecosystem on Mac OS X

3,486 views

Published on

Presentation delivered at NSConference 2009, Hatfield, UK.

Published in: Technology, Art & Photos
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/36cXjBY ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ❶❶❶ http://bit.ly/36cXjBY ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Integrating with the Photography Ecosystem on Mac OS X

  1. 1. Integrating with the Photography Ecosystem on Mac OS X
  2. 2. The Ecosystem
  3. 3. The Ecosystem Image Capture
  4. 4. The Ecosystem Image IO Image Capture
  5. 5. The Ecosystem Image Kit Quicktime Core Image Image IO Image Capture
  6. 6. The Ecosystem iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  7. 7. Today iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  8. 8. No Private APIs Photo: Trey Ratcliff/Flickr
  9. 9. RAW
  10. 10. Photo: Flickr user Svet
  11. 11. • Sensor data + decision data Photo: Flickr user Svet
  12. 12. • Sensor data + decision data • No processing in-camera Photo: Flickr user Svet
  13. 13. • Sensor data + decision data • No processing in-camera • No compression Photo: Flickr user Svet
  14. 14. • Sensor data + decision data • No processing in-camera • No compression • Big Files Photo: Flickr user Svet
  15. 15. • Sensor data + decision data • No processing in-camera • No compression • Big Files • Every camera needs specific support Photo: Flickr user Svet
  16. 16. Photographers who spend money on their craft shoot RAW.
  17. 17. Photographers who will buy your application shoot RAW.
  18. 18. Do not assume you can pretend that RAW doesn’t exist.
  19. 19. That said, you do not want to be on the treadmill of directly supporting RAW formats.
  20. 20. Even Apple struggles with that.
  21. 21. Let Lightroom, Aperture or iPhoto handle it
  22. 22. Photography Workflow Ingest Metadata Edit Output
  23. 23. Workflow • Image Capture • Ingest Aperture • Lightroom • iPhoto
  24. 24. Workflow Ingest Metadata Edit Output
  25. 25. Workflow • Title • Metadata Captions • Copyright • Keywords
  26. 26. Metadata is a lot of effort: respect that Metadata effort.
  27. 27. GPS Metadata workflow still Metadata sucks.
  28. 28. Temporary Metadata problem.
  29. 29. One day, all cameras will write geodata Metadata to EXIF.
  30. 30. Workflow Ingest Metadata Edit Output
  31. 31. Workflow • Photoshop: pixel editing • Edit iPhoto: Master + single Version • Aperture: Master + Versions model
  32. 32. Master File (usually RAW)
  33. 33. Default Core Image Recipe Master File (usually RAW)
  34. 34. Default Exposure Core Core Image Image Recipe Recipe Master File (usually RAW)
  35. 35. Default Exposure B &W Core Core Core Image Image Image Recipe Recipe Recipe Master File (usually RAW)
  36. 36. Default Exposure B &W Crop Core Core Core Core Image Image Image Image Recipe Recipe Recipe Recipe Master File (usually RAW)
  37. 37. {CI Recipe} {CI Recipe}
  38. 38. {Image Record} {CI Recipe} {CI Recipe}
  39. 39. {Image Record} {CI Recipe} {CI Recipe}
  40. 40. What exists and when? • Master file exists, but may be offline. • A JPEG preview may exist. • CI recipes exist in Aperture DB.
  41. 41. Preview generation is a preference
  42. 42. Workflow Ingest Metadata Edit Output
  43. 43. Workflow Output
  44. 44. Workflow • Version Export to disk Output
  45. 45. Workflow • Version Export to disk • Media Browser Output
  46. 46. Workflow • Version Export to disk • Media Browser Output • Drag & Drop previews out of Aperture
  47. 47. Workflow • Version Export to disk • Media Browser Output • Drag & Drop previews out of Aperture • Export plugins
  48. 48. Media Browser
  49. 49. Media Browser • No API for Apple’s Media Browser
  50. 50. Media Browser • No API for Apple’s Media Browser • Check out Karelia’s iMedia Browser • karelia.com/imedia
  51. 51. Preview Fingerprint
  52. 52. Preview Fingerprint Aperture writes its internal ID to the IPTC Special Instructions in previews.
  53. 53. Preview Fingerprint Aperture writes its internal ID to the IPTC Special Instructions in previews. mRG3bpEnT0GOSJ9qNuxk+g
  54. 54. Preview Fingerprint Aperture writes its internal ID to the IPTC Special Instructions in previews. mRG3bpEnT0GOSJ9qNuxk+g You can access versions by ID through AppleScript
  55. 55. The Ecosystem iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  56. 56. Image IO iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  57. 57. Your interface to RAW
  58. 58. Your interface to EXIF and IPTC
  59. 59. Your interface to thumbnail generation
  60. 60. Part of ApplicationServices framework
  61. 61. CGImageSource
  62. 62. CGImageSource • CGImageSourceCreateWithURL()
  63. 63. CGImageSource • CGImageSourceCreateWithURL() • CGImageSourceCopyPropertiesAtIndex()
  64. 64. CGImageSource • CGImageSourceCreateWithURL() • CGImageSourceCopyPropertiesAtIndex() • CGImageSourceCreateImageAtIndex()
  65. 65. CGImageSource • CGImageSourceCreateWithURL() • CGImageSourceCopyPropertiesAtIndex() • CGImageSourceCreateImageAtIndex() • CGImageSourceCreateThumbnailAtIndex()
  66. 66. CGImageSourceCopyPropertiesAtIndex() • Returns a dictionary of key/value pairs representing image metadata. • EXIF, IPTC, Manufacturer-specific fields • Keys are defined in CGImageProperties.h
  67. 67. High-level dictionaries kCGImageProperty{*}Dictionary • • TIFF MakerCanon • • GIF MakerNikon • • JFIF MakerMinolta • • Exif MakerFuji • • PNG MakerOlympus • • IPTC MakerPentax • • GPS 8BIM • • Raw DNG • • CIFF ExifAux
  68. 68. EXIF Keys • kCGImagePropertyExifExposureTime • kCGImagePropertyExifFNumber • kCGImagePropertyExifExposureProgram • kCGImagePropertyExifFocalLength • kCGImagePropertyExifISOSpeedRatings • ...etc...
  69. 69. GPS Keys • kCGImagePropertyGPSLatitude • kCGImagePropertyGPSLongitude • kCGImagePropertyGPSAltitude • kCGImagePropertyGPSTimeStamp • kCGImagePropertyGPSDOP • ...etc...
  70. 70. #1 ImageIO Gotcha: nothing is guaranteed.
  71. 71. Do not assume the existence of any key in this dictionary.
  72. 72. After all, cameras come from hardware manufacturers and they never support anything entirely correctly.
  73. 73. CGImageSourceCreateImageAtIndex() • Creates a CGImageRef from an image in the file. • Most image files have one image, but there is support for multiple representations. • CGImageSourceGetCount() tells you how many there are.
  74. 74. CGImageSourceCreateThumbnailAtIndex() • Creates a thumbnail from an index • Control thumbnail size with the options dictionary: • kCGImageSourceThumbnailMaxPixelSize
  75. 75. #2 ImageIO Gotcha: can’t write RAW files.
  76. 76. This is not your nibware geotagging API.
  77. 77. The Ecosystem iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  78. 78. Image Kit iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  79. 79. Image Kit: iPhoto in a box
  80. 80. Image Kit: iPhoto in a box IKImageBrowserView IKImageView IKSlideshow IKImageEditPanel
  81. 81. IKImageBrowserView
  82. 82. IKImageBrowserView
  83. 83. IKImageBrowserView provides:
  84. 84. IKImageBrowserView provides: • Fast, scalable, memory-efficient thumbnail view.
  85. 85. IKImageBrowserView provides: • Fast, scalable, memory-efficient thumbnail view. • Zooming
  86. 86. IKImageBrowserView provides: • Fast, scalable, memory-efficient thumbnail view. • Zooming • Selection
  87. 87. IKImageBrowserView provides: • Fast, scalable, memory-efficient thumbnail view. • Zooming • Selection • Grouping (iPhoto-style and Aperture-style)
  88. 88. IKGroupDisclosureStyle iPhoto: Thumbnails
  89. 89. IKGroupDisclosureStyle iPhoto: Thumbnails
  90. 90. IKGroupDisclosureStyle iPhoto: Thumbnails
  91. 91. IKGroupBezelStyle Aperture: Stacks
  92. 92. IKGroupBezelStyle Aperture: Stacks
  93. 93. IKGroupBezelStyle Aperture: Stacks
  94. 94. IKImageBrowserDataSource
  95. 95. IKImageBrowserDataSource • Required:
  96. 96. IKImageBrowserDataSource • Required: • -numberOfItemsInImageBrowser:
  97. 97. IKImageBrowserDataSource • Required: • -numberOfItemsInImageBrowser: • -imageBrowser:itemAtIndex:
  98. 98. IKImageBrowserDataSource • Required: • -numberOfItemsInImageBrowser: • -imageBrowser:itemAtIndex: • Returned item must implement IKImageBrowserItem protocol
  99. 99. IKImageBrowserItem • Required: • - (NSString *) imageUID • - (NSString *) imageRepresentationType • Constants for supported types • - (id) imageRepresentation
  100. 100. IKImageBrowser{*}RepresentationType • • Path QTMovie • • NSURL QTMoviePath • • NSImage QCComposition • • CGImage QCCompositionPath • • CGImageSource QuickLookPath • • NSData IconRefPath • • NSBitmapImage IconRef
  101. 101. IKImageBrowserDataSource
  102. 102. IKImageBrowserDataSource • Optional:
  103. 103. IKImageBrowserDataSource • Optional: • -numberOfGroupsInImageBrowser:
  104. 104. IKImageBrowserDataSource • Optional: • -numberOfGroupsInImageBrowser: • -(NSDictionary *)imageBrowser:groupAtIndex:
  105. 105. IKImageBrowserDataSource • Optional: • -numberOfGroupsInImageBrowser: • -(NSDictionary *)imageBrowser:groupAtIndex: • IKImageBrowserGroupStyle
  106. 106. IKImageBrowserDataSource • Optional: • -numberOfGroupsInImageBrowser: • -(NSDictionary *)imageBrowser:groupAtIndex: • IKImageBrowserGroupStyle • IKImageBrowserGroupBackgroundColorKey
  107. 107. IKImageBrowserDataSource • Optional: • -numberOfGroupsInImageBrowser: • -(NSDictionary *)imageBrowser:groupAtIndex: • IKImageBrowserGroupStyle • IKImageBrowserGroupBackgroundColorKey • IKImageBrowserGroupTitleKey
  108. 108. IKImageBrowserDataSource • Optional: • -numberOfGroupsInImageBrowser: • -(NSDictionary *)imageBrowser:groupAtIndex: • IKImageBrowserGroupStyle • IKImageBrowserGroupBackgroundColorKey • IKImageBrowserGroupTitleKey • IKImageBrowserGroupRangeKey
  109. 109. NSMakeRange(0,4)
  110. 110. NSMakeRange(0,4) NSMakeRange(4,2)
  111. 111. NSMakeRange(0,4) NSMakeRange(4,2) NSMakeRange(6,2)
  112. 112. NSMakeRange(0,4) NSMakeRange(4,2) NSMakeRange(6,2) NSMakeRange(8,3)
  113. 113. Two Gotchas
  114. 114. Two Gotchas • Constants for IKImageBrowserGroupStyleKey are defined in an enum, so pack them in NSNumber.
  115. 115. Two Gotchas • Constants for IKImageBrowserGroupStyleKey are defined in an enum, so pack them in NSNumber. • IKImageBrowserGroupRangeKey’s value should be an NSRange packed into an NSValue.
  116. 116. IKImageView • Rotate • Zoom • Crop • Drag & Drop • Quite hard to customise for additional functionality
  117. 117. IKImageEditPanel
  118. 118. IKImageEditPanel
  119. 119. IKImageEditPanel
  120. 120. IKImageEditPanel
  121. 121. IKSlideshow
  122. 122. IKSlideshow • Think: Quick Look slideshow in Finder.
  123. 123. IKSlideshow • Think: Quick Look slideshow in Finder. • IKSlideshowDataSource:
  124. 124. IKSlideshow • Think: Quick Look slideshow in Finder. • IKSlideshowDataSource: • -numberOfSlideshowItems
  125. 125. IKSlideshow • Think: Quick Look slideshow in Finder. • IKSlideshowDataSource: • -numberOfSlideshowItems • -slideshowItemAtIndex:
  126. 126. IKSlideshow • Think: Quick Look slideshow in Finder. • IKSlideshowDataSource: • -numberOfSlideshowItems • -slideshowItemAtIndex: • -nameOfSlideshowItemAtIndex:
  127. 127. IKSlideshow • Think: Quick Look slideshow in Finder. • IKSlideshowDataSource: • -numberOfSlideshowItems • -slideshowItemAtIndex: • -nameOfSlideshowItemAtIndex: • -canExportSlideshowItemAtIndex: toApplication:
  128. 128. IKSlideshow items
  129. 129. IKSlideshow items • No interface to implement, just return:
  130. 130. IKSlideshow items • No interface to implement, just return: • NSImage
  131. 131. IKSlideshow items • No interface to implement, just return: • NSImage • NSString (a path)
  132. 132. IKSlideshow items • No interface to implement, just return: • NSImage • NSString (a path) • NSURL
  133. 133. IKSlideshow items • No interface to implement, just return: • NSImage • NSString (a path) • NSURL • NSFileWrapper
  134. 134. IKSlideshow items • No interface to implement, just return: • NSImage • NSString (a path) • NSURL • NSFileWrapper • CGImageRef
  135. 135. IKSlideshow items • No interface to implement, just return: • NSImage • NSString (a path) • NSURL • NSFileWrapper • CGImageRef • PDFPage
  136. 136. The Ecosystem iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  137. 137. Aperture iPhoto Aperture Your App! Image Kit Quicktime Core Image Image IO Image Capture
  138. 138. Export Plugins
  139. 139. Export Plugins • Primary method of getting data from Aperture and iPhoto.
  140. 140. Export Plugins • Primary method of getting data from Aperture and iPhoto. • ObjC API-level access to Aperture
  141. 141. Export Plugins • Primary method of getting data from Aperture and iPhoto. • ObjC API-level access to Aperture • Focus on Aperture, mostly also valid for iPhoto
  142. 142. Export Plugins • Primary method of getting data from Aperture and iPhoto. • ObjC API-level access to Aperture • Focus on Aperture, mostly also valid for iPhoto • SDKs for both apps from connect.apple.com
  143. 143. Process Select Export Plugin UI Rendering Post-Export
  144. 144. Rendering MyPlugin ApertureExportManager -exportManagerShouldBeginExport -shouldBeginExport -exportManagerWillBeginExportToPath: -exportManagerShouldExportImageAtIndex:
  145. 145. Rendering MyPlugin ApertureExportManager exportManagerShouldWriteImageData: toRelativePath:forImageAtIndex: exportManagerDidWriteImageDataToRelativePath: forImageAtIndex: -exportManagerDidFinishExport
  146. 146. Process: Post-Export Post-Export
  147. 147. Process: Post-Export • Upload the images to the web • FlickrExport does all its upload work in exportManagerDidFinishExport Post-Export
  148. 148. Process: Post-Export • Upload the images to the web • FlickrExport does all its upload work in exportManagerDidFinishExport Post-Export • AppleScript another application to ingest them
  149. 149. Process: Post-Export • Upload the images to the web • FlickrExport does all its upload work in exportManagerDidFinishExport Post-Export • AppleScript another application to ingest them • Burn a disc
  150. 150. Process: Post-Export • Upload the images to the web • FlickrExport does all its upload work in exportManagerDidFinishExport Post-Export • AppleScript another application to ingest them • Burn a disc • Add metadata back to Aperture
  151. 151. Aperture Metadata • - addKeywords:toImageAtIndex: • - addHierarchicalKeywords:toImageAtIndex: • - addCustomMetadataKeyValues: toImageAtIndex:
  152. 152. Hierarchical Keywords Events > Conferences > C4[2] > Craig Hockenberry
  153. 153. addKeywords: toImageAtIndex:
  154. 154. addKeywords: toImageAtIndex: • Be careful: all keywords become top-level keywords in Aperture’s hierarchy,
  155. 155. addKeywords: toImageAtIndex: • Be careful: all keywords become top-level keywords in Aperture’s hierarchy, • Mess
  156. 156. addKeywords: toImageAtIndex: • Be careful: all keywords become top-level keywords in Aperture’s hierarchy, • Mess • Remember: photographers == picky curmudgeons obsessed with organisation
  157. 157. -addHierarchicalKeywords: toImageAtIndex: NSArray *kwdOne = [NSArray arrayWithObjects: @”Foo”, @”Bar”, @”Baz”, nil]; NSArray *allKeywds = [NSArray arrayWithObject: kwdOne];
  158. 158. -addHierarchicalKeywords: toImageAtIndex: NSArray *kwdOne = [NSArray arrayWithObjects: @”Foo”, Leaf Keyword @”Bar”, @”Baz”, nil]; NSArray *allKeywds = [NSArray arrayWithObject: kwdOne];
  159. 159. -addHierarchicalKeywords: toImageAtIndex: NSArray *kwdOne = [NSArray arrayWithObjects: @”Foo”, Leaf Keyword @”Bar”, Parent @”Baz”, nil]; NSArray *allKeywds = [NSArray arrayWithObject: kwdOne];
  160. 160. -addHierarchicalKeywords: toImageAtIndex: NSArray *kwdOne = [NSArray arrayWithObjects: @”Foo”, Leaf Keyword @”Bar”, Parent @”Baz”, Parent nil]; NSArray *allKeywds = [NSArray arrayWithObject: kwdOne];
  161. 161. addCustomMetadataKeyValues: toImageAtIndex: • Arbitrary dictionary of key/value pairs • Must be NSStrings • Appear in Aperture’s metadata inspector • Can be used in Smart Album criteria
  162. 162. FlickrExport Example • FlickrExport writes back: • Flickr ID • Flickr URL • Knowing the Flickr ID of a version in Aperture lets FlickrExport do replacement on a re-export
  163. 163. Custom metadata Custom Value Key
  164. 164. [“Flickr ID” length] != 0
  165. 165. rating >= 3 && [“Flickr ID” length] == 0
  166. 166. iPhoto Limitations • Can’t add metadata back to iPhoto • Can’t create new keywords • API has different method names, but conceptually almost identical
  167. 167. Thank You • fraser@speirs.org • @fraserspeirs • http://speirs.org • http://connectedflow.com

×