hMatoba / piexifjs

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

Can't write EXIF data if input data differs from expected value in TAGS array. #12

Closed francois56234 closed 8 years ago

francois56234 commented 8 years ago

I have an image with ProfileCopyright data ("aStringValue") set with a type of 'Ascii'.

I can read the image, get the EXIF, but when I write the EXIF to the modified file, the existing code retrieves the expected type for this field (TAGS[50942] -> "Byte") and attempt to save {50942, "Byte", "aStringValue"} which fails because "Byte" expects an Array, not a String.

I'm not familiar enough with EXIF to be sure whether the error lies in the input file or in piexeif (which is very nice, thank you). ProfileCopyright is not listed in the documentation for EXIF 2.3, but it is listed on http://www.exiv2.org/tags.html.

hMatoba commented 8 years ago

If you want to set "Byte", convert string into array of integers(ex. "[30, 31, 50...]"). http://piexifjs.readthedocs.io/en/latest/appendices.html