Project

General

Profile

Bug #864 ยป 864.MWG.simple.diff

Clean patch on trunk - Alan Pater, 21 Apr 2015 12:55

View differences:

src/convert.cpp (working copy)
144 144
        //! @name Conversion functions (manipulators)
145 145
        //@{
146 146
        /*!
147
          @brief Do nothing conversion function.
148

  
149
          Use when, for example, a one-way conversion is needed.
150
         */
151
        void cnvNone(const char*, const char*);
152
        /*!
147 153
          @brief Simple Exif to XMP conversion function.
148 154

  
149 155
          Sets the XMP property to an XmpText value containing the Exif value string.
......
322 328
        { mdExif, "Exif.Image.PrimaryChromaticities",     "Xmp.tiff.PrimaryChromaticities",     &Converter::cnvExifValue, &Converter::cnvXmpValue },
323 329
        { mdExif, "Exif.Image.YCbCrCoefficients",         "Xmp.tiff.YCbCrCoefficients",         &Converter::cnvExifValue, &Converter::cnvXmpValue },
324 330
        { mdExif, "Exif.Image.ReferenceBlackWhite",       "Xmp.tiff.ReferenceBlackWhite",       &Converter::cnvExifValue, &Converter::cnvXmpValue },
325
        { mdExif, "Exif.Image.DateTime",                  "Xmp.tiff.DateTime",                  &Converter::cnvExifDate , &Converter::cnvXmpDate  },
331
        { mdExif, "Exif.Image.DateTime",                  "Xmp.xmp.ModifyDate",                 &Converter::cnvExifDate , &Converter::cnvXmpDate  }, // MWG Guidelines
326 332
        { mdExif, "Exif.Image.ImageDescription",          "Xmp.dc.description",                 &Converter::cnvExifValue, &Converter::cnvXmpValue },
327 333
        { mdExif, "Exif.Image.Make",                      "Xmp.tiff.Make",                      &Converter::cnvExifValue, &Converter::cnvXmpValue },
328 334
        { mdExif, "Exif.Image.Model",                     "Xmp.tiff.Model",                     &Converter::cnvExifValue, &Converter::cnvXmpValue },
......
339 345
        { mdExif, "Exif.Photo.PixelYDimension",           "Xmp.exif.PixelYDimension",           &Converter::cnvExifValue, &Converter::cnvXmpValue },
340 346
        { mdExif, "Exif.Photo.UserComment",               "Xmp.exif.UserComment",               &Converter::cnvExifComment, &Converter::cnvXmpComment },
341 347
        { mdExif, "Exif.Photo.RelatedSoundFile",          "Xmp.exif.RelatedSoundFile",          &Converter::cnvExifValue, &Converter::cnvXmpValue },
342
        { mdExif, "Exif.Photo.DateTimeOriginal",          "Xmp.exif.DateTimeOriginal",          &Converter::cnvExifDate,  &Converter::cnvXmpDate  },
343
        { mdExif, "Exif.Photo.DateTimeDigitized",         "Xmp.exif.DateTimeDigitized",         &Converter::cnvExifDate,  &Converter::cnvXmpDate  },
348
        { mdExif, "Exif.Photo.DateTimeOriginal",          "Xmp.photoshop.DateCreated",          &Converter::cnvExifDate,  &Converter::cnvXmpDate  }, // MWG Guidelines
349
        { mdExif, "Exif.Photo.DateTimeDigitized",         "Xmp.xmp.CreateDate",                 &Converter::cnvExifDate,  &Converter::cnvXmpDate  }, // MWG Guidelines
344 350
        { mdExif, "Exif.Photo.ExposureTime",              "Xmp.exif.ExposureTime",              &Converter::cnvExifValue, &Converter::cnvXmpValue },
345 351
        { mdExif, "Exif.Photo.FNumber",                   "Xmp.exif.FNumber",                   &Converter::cnvExifValue, &Converter::cnvXmpValue },
346 352
        { mdExif, "Exif.Photo.ExposureProgram",           "Xmp.exif.ExposureProgram",           &Converter::cnvExifValue, &Converter::cnvXmpValue },
......
417 423
        { mdIptc, "Iptc.Application2.Keywords",           "Xmp.dc.subject",                     &Converter::cnvIptcValue, &Converter::cnvXmpValueToIptc },
418 424
        { mdIptc, "Iptc.Application2.SubLocation",        "Xmp.iptc.Location",                  &Converter::cnvIptcValue, &Converter::cnvXmpValueToIptc },
419 425
        { mdIptc, "Iptc.Application2.SpecialInstructions","Xmp.photoshop.Instructions",         &Converter::cnvIptcValue, &Converter::cnvXmpValueToIptc },
420
        { mdIptc, "Iptc.Application2.DateCreated",        "Xmp.photoshop.DateCreated",          &Converter::cnvIptcValue, &Converter::cnvXmpValueToIptc },
426
        { mdIptc, "Iptc.Application2.DateCreated",        "Xmp.photoshop.DateCreated",          &Converter::cnvNone, &Converter::cnvXmpValueToIptc }, // FIXME to IPTC Date and IPTC Time
427
        { mdIptc, "Iptc.Application2.DigitizationDate",   "Xmp.xmp.CreateDate",                 &Converter::cnvNone, &Converter::cnvXmpValueToIptc }, // FIXME to IPTC Date and IPTC Time
421 428
        { mdIptc, "Iptc.Application2.Byline",             "Xmp.dc.creator",                     &Converter::cnvIptcValue, &Converter::cnvXmpValueToIptc },
422 429
        { mdIptc, "Iptc.Application2.BylineTitle",        "Xmp.photoshop.AuthorsPosition",      &Converter::cnvIptcValue, &Converter::cnvXmpValueToIptc },
423 430
        { mdIptc, "Iptc.Application2.City",               "Xmp.photoshop.City",                 &Converter::cnvIptcValue, &Converter::cnvXmpValueToIptc },
......
466 473
        }
467 474
    }
468 475

  
476
    void Converter::cnvNone(const char*, const char*)
477
    {
478
        return;
479
    }
480

  
469 481
    bool Converter::prepareExifTarget(const char* to, bool force)
470 482
    {
471 483
        Exiv2::ExifData::iterator pos = exifData_->findKey(ExifKey(to));
test/conversions.sh (working copy)
185 185
	runTest exiv2 -M'set Exif.GPSInfo.GPSLatitudeRef N' u.jpg
186 186
	runTest exiv2 -M'set Exif.GPSInfo.GPSVersionID 2 2 0 1' u.jpg
187 187
	runTest exiv2 -M'set Exif.GPSInfo.GPSTimeStamp 1/1 2/1 999999999/1000000000' u.jpg
188
	runTest exiv2 -M'set Iptc.Application2.DateCreated 2007-05-09' u.jpg
189 188
	
190 189
	runTest exiv2 -PEkycv u.jpg
191 190
	runTest exiv2 -pi u.jpg
......
201 200
	echo ===========
202 201
	copyTestFile $IMG v.jpg
203 202
	copy u.xmp v.xmp
204
	runTest exiv2 -M'set Xmp.tiff.DateTime 2003-12-14T12:01:44Z' v.xmp
203
	runTest exiv2 -M'set Xmp.xmp.ModifyDate 2015-04-17T18:10:22Z' v.xmp
205 204
	TZ=GMT-8 runTest exiv2 -iX v.jpg
206 205
	runTest exiv2 -px v.jpg
207 206
	runTest exiv2 -PEkycv v.jpg
......
215 214
reportTest $results-stripped $good
216 215

  
217 216
# That's all Folks!
218
##
217
##
test/data/conversions.out (working copy)
124 124
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  N
125 125
Exif.GPSInfo.GPSLatitude                     Rational    3  3/1 8/1 29734512/1000000
126 126
Exif.GPSInfo.GPSTimeStamp                    Rational    3  1/1 2/1 999999999/1000000000
127
Iptc.Application2.DateCreated                Date        8  2007-05-09
127
u.jpg: (No IPTC data found in the file)
128 128
Xmp.exif.ExifVersion                         XmpText     4  2.21
129
Xmp.exif.DateTimeOriginal                    XmpText    29  2003-12-14T12:01:44.999999999
130 129
Xmp.exif.GPSVersionID                        XmpText     7  2.2.0.1
131 130
Xmp.exif.GPSLatitude                         XmpText    12  3,8.4955752N
132 131
Xmp.exif.GPSTimeStamp                        XmpText    29  2003-12-14T01:02:00.999999999
......
137 136
Xmp.exif.Flash/exif:Mode                     XmpText     1  1
138 137
Xmp.exif.Flash/exif:Function                 XmpText     5  False
139 138
Xmp.exif.Flash/exif:RedEyeMode               XmpText     4  True
140
Xmp.photoshop.DateCreated                    XmpText    10  2007-05-09
139
Xmp.photoshop.DateCreated                    XmpText    29  2003-12-14T12:01:44.999999999
141 140
Exif.Photo.ExifVersion                       Undefined   4  48 50 50 49
142 141
Exif.Photo.ComponentsConfiguration           Undefined   4  1 2 3 0
143 142
Exif.Photo.DateTimeOriginal                  Ascii      20  2003:12:14 12:01:44
......
148 147
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  N
149 148
Exif.GPSInfo.GPSTimeStamp                    Rational    3  1/1 2/1 999999999/1000000000
150 149
Exif.GPSInfo.GPSDateStamp                    Ascii      11  2003:12:14
151
Iptc.Application2.DateCreated                Date        8  2007-05-09
150
Iptc.Application2.DateCreated                Date        8  2003-12-14
152 151
Iptc.Envelope.CharacterSet                   String      3  $%G
153 152

  
154 153
Testcase 15
155 154
===========
156 155
Xmp.exif.ExifVersion                         XmpText     4  2.21
157
Xmp.exif.DateTimeOriginal                    XmpText    29  2003-12-14T12:01:44.999999999
158 156
Xmp.exif.GPSVersionID                        XmpText     7  2.2.0.1
159 157
Xmp.exif.GPSLatitude                         XmpText    12  3,8.4955752N
160 158
Xmp.exif.GPSTimeStamp                        XmpText    29  2003-12-14T01:02:00.999999999
......
165 163
Xmp.exif.Flash/exif:Function                 XmpText     5  False
166 164
Xmp.exif.Flash/exif:RedEyeMode               XmpText     4  True
167 165
Xmp.exif.ComponentsConfiguration             XmpSeq      4  YCbCr
168
Xmp.tiff.DateTime                            XmpText    20  2003-12-14T12:01:44Z
169
Xmp.photoshop.DateCreated                    XmpText    10  2007-05-09
170
Exif.Image.DateTime                          Ascii      20  2003:12:14 20:01:44
166
Xmp.xmp.ModifyDate                           XmpText    20  2015-04-17T18:10:22Z
167
Xmp.photoshop.DateCreated                    XmpText    29  2003-12-14T12:01:44.999999999
168
Exif.Image.DateTime                          Ascii      20  2015:04:18 02:10:22
171 169
Exif.Image.ExifTag                           Long        1  70
172 170
Exif.Photo.ExifVersion                       Undefined   4  48 50 50 49
173 171
Exif.Photo.DateTimeOriginal                  Ascii      20  2003:12:14 12:01:44
......
181 179
Exif.GPSInfo.GPSTimeStamp                    Rational    3  1/1 2/1 999999999/1000000000
182 180
Exif.GPSInfo.GPSDateStamp                    Ascii      11  2003:12:14
183 181
Iptc.Envelope.CharacterSet                   String      3  $%G
184
Iptc.Application2.DateCreated                Date        8  2007-05-09
182
Iptc.Application2.DateCreated                Date        8  2003-12-14
    (1-1/1)