photo / frontend

The official @github repository of the Trovebox frontend software. A photo sharing and photo management web interface for data stored "in the cloud" (i.e. Amazon S3, Rackspace CloudFiles, Google Storage).
https://trovebox.com
Apache License 2.0
1.37k stars 244 forks source link

Implement XMP extraction (Was: Exif: geolocation, tags and title not extracted properly on this photo) #378

Open jmathai opened 12 years ago

jmathai commented 12 years ago

Uploaded to: http://test.openphoto.me/photo/f/view Original file: http://awesomeness.openphoto.me/original/201112/1323641686-Untitled_3129457390_o.jpg

ExifTool Version Number         : 8.72
File Name                       : Untitled_3129457390_o.jpg
Directory                       : .
File Size                       : 70 kB
File Modification Date/Time     : 2011:12:11 14:13:53-08:00
File Permissions                : rw-r--r--
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Current IPTC Digest             : 717964420d38c85f3238d694cec521ca
Coded Character Set             : UTF8
Application Record Version      : 2
Profile CMM Type                : Lino
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : IEC
Device Model                    : sRGB
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Media-Relative Colorimetric
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : HP
Profile ID                      : 0
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Device Mfg Desc                 : IEC http://www.iec.ch
Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
Viewing Cond Surround           : 3.92889 4.07439 3.36179
Viewing Cond Illuminant Type    : D50
Luminance                       : 76.03647 80 87.12462
Measurement Observer            : CIE 1931
Measurement Backing             : 0 0 0
Measurement Geometry            : Unknown (0)
Measurement Flare               : 0.999%
Measurement Illuminant          : D65
Technology                      : Cathode Ray Tube Display
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
Exif Byte Order                 : Big-endian (Motorola, MM)
Color Space                     : sRGB
Exif Image Width                : 640
Exif Image Height               : 480
XMP Toolkit                     : Adobe XMP Core 5.0.0-ac003
GPS Latitude                    : 40 deg 0' 52.08" N
GPS Longitude                   : 75 deg 36' 50.49" W
Creator Tool                    : Bulkr
Type                            : Photo
Title                           : Untitled
Creator                         : 3e
Description                     : 
Subject                         : Daniel Drucker, cat, 266, Ada Drucker, animal
Keywords                        : Daniel Drucker, cat, 266, Ada Drucker, animal
Image Width                     : 640
Image Height                    : 480
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
GPS Latitude Ref                : North
GPS Longitude Ref               : West
Image Size                      : 640x480
GPS Position                    : 40 deg 0' 52.08" N, 75 deg 36' 50.49" W
hfiguiere commented 12 years ago

iptc show there is barely anything in it.

it is all in the XMP metadata which we don't decode in openphoto.

jmathai commented 12 years ago

@hfiguiere should we leave this open to add XMP parsing in OpenPhoto?

hfiguiere commented 12 years ago

yep. but in the current context, it might not be that easy.

jmathai commented 12 years ago

Here's a thread on using SimpleXML to read the XMP data from an image.

http://stackoverflow.com/questions/1578169/how-can-i-read-xmp-data-from-a-jpg-with-php

pixelistik commented 12 years ago

The GPL 2 licensed ZenPhoto CMS seems to have a working implementation of XMP metadata import. Docs and source are available.

jmathai commented 12 years ago

Looks like it's pretty tighly coupled with the zenphoto framework. We could just yank out the bits we need.

hfiguiere commented 12 years ago

Also, technically GPLv2 isn't compatible with Apache v2 (but there are ways).

I'll look at it.

jmathai commented 12 years ago

I always forget we're using Apache. I checked for GPL compatibility for the MIT license.

pixelistik commented 12 years ago

The SimpleXML implementation idea seems much cleaner. What the ZenPhoto solution boils down to is a custom XML parser, with stuff as simple as

$s = strpos($xmpdata, '<');
$e = strpos($xmpdata,'>',$s);

that looks for some known tags.

hfiguiere commented 12 years ago

Let's put it that way: the work to be done is to extract the XMP block, for which we need to parse JPEG. The XMP block in the end is just RDF. And that we have tools.

jmathai commented 12 years ago

Sounds like @hfiguiere just took this task on!

hfiguiere commented 12 years ago

I had been the assignee for quite a while :-)

ghost commented 11 years ago

I'm the owner of bug #1323 and now i understand why i wasn't able to find this related bug... it's already two years old. Sorry for the duplicate.

Because of this missing feature the best way for me to add tags to many different photos is to use the new beta-uploader, add all tags into the Tags-box and upload all photos 1-by-1. I tried to do that for 58 files using Batch-edit, but that isn't really an alternative and will take much more time then upload all files 1-by-1 (pin photos, manage tags, clear all pinned photos, pin some other photos... and you always have to "hit" that small pin on the photos in the gallery). Maybe it is better to not tag the photos at all...

When you open a photo and go to "Full details" you can click on "Add description". I suggest to "Add tags" also.

So either add the xmp-support or make it more easy to add tags to many photos or when view a single photo. Hopefully this feature will find the way into stable one day...

hfiguiere commented 11 years ago

The fact that it is that old shouldn't matter to find it. I typed "XMP" in the serach box.

Where do these pictures come from? Importing pictures I exported from Lightroom or Aperture do import the tags properly, because both of these application store the keywords in IPTC which we can easily extracted from the JPEG.

jmathai commented 11 years ago

We're aware that this is a general usability issue that needs resolution.

you always have to "hit" that small pin on the photos in the gallery

You can alt+click a photo to select it. Another shortcut is to shift+click on the first photo and shift+click on another photo to select that range.

So either add the xmp-support or make it more easy to add tags to many photos or when view a single photo.

We need both...