hMatoba / piexifjs

Read and modify exif in client-side or server-side JavaScript.
MIT License
572 stars 119 forks source link

0th ImageDescription #16

Closed lucastimmons closed 8 years ago

lucastimmons commented 8 years ago

The loadsample.html example doesn't show ImageDescription (270) when the image loads. I can't find a way to extract it.

Using the library I can write to 270 (zerothIfd[piexif.ImageIFD.ImageDescription] = "Description"; in the dumpsample.html file.

Is there a reason ImageDescription doesn't appear?

hMatoba commented 8 years ago

?

https://github.com/hMatoba/MinifyJpegAsync/issues/4

lucastimmons commented 8 years ago

Same problem.

I want to resize an image but also keep the ImageDescritpion as part of the exif data.

hMatoba/MinifyJpegAsync doesn't keep the ImageDescription data. So I was going to use piexifjs to copy the ImageDescription into memory, resize the image, then write the image description back to the resized image and download it.

In both projects the ImageDescription (Tag 270) isn't extracted from the image when the image is loaded in. In the example in hMatoba/MinifyJpegAsync the image description is gone when the image is downloaded.

As you can see in these screen grabs, the photo itself has an image description but it doesn't appear when loaded into the PixelifJS LoadSample.html file.

screen shot 2016-09-08 at 10 26 30 pm screen shot 2016-09-08 at 10 26 42 pm

This doesn't happen for every file. Sometimes the image description does show up. I just need to have a way to make sure it always shows up, even if it means no other metadata is saved.

hMatoba commented 8 years ago

Could yo give me images?

lucastimmons commented 8 years ago

Here are three I've tried and I get no image description but they do all have an image description.

http://awesome.lucastimmons.com/testimages/1.jpg http://awesome.lucastimmons.com/testimages/2.jpg http://awesome.lucastimmons.com/testimages/3.jpg

hMatoba commented 8 years ago
603e2f16-7613-11e6-9778-267874e696e0

Is this really exif's ImageDescription? Isn't it XMP's?

lucastimmons commented 8 years ago

Here's one that came from the same source that does work in the LoadSample.html file. http://awesome.lucastimmons.com/testimages/4.jpg

Looking at the raw data for both, the description is tagged like this:

img2.jpg:

     <dc:description>
        <rdf:Alt>
           <rdf:li xml:lang="x-default">A gate blocks the entrance to Richard Henry Bain's fishing camp in La Conception, near Mont-Tremblant, Que. on Wednesday Sept. 5, 2012. Police sources confirmed they arrested a suspect by that name in the Montreal shooting that left one person dead and made headlines around the world. THE CANADIAN PRESS/Andy Blatchford</rdf:li>
        </rdf:Alt>
     </dc:description>

img4.jpg dc:description rdf:Alt

Rogers Place Arena, the new home of the Edmonton Oilers, in Edmonton, Alta., on Thursday, September 8, 2016. THE CANADIAN PRESS/Jason Franson/rdf:li /rdf:Alt /dc:description So it appears they are tagged the same way. Not sure why one works and the other doesn't. I think it might have to do with the length of the imagedescription itself.
hMatoba commented 8 years ago

Isn't it XMP's!? Have you tried other library? I tried and can't find "ImageDescription" in exif.

http://regex.info/exif.cgi