You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to modify exif orientation, which I'm able to do for most images, but for some images some exif data (like "Make", "Model", "X-resolution", "Y-resolution") gets corrupted or lost.
So I tried to compare exif objects before and after modification on those problematic images, but when I try to get exif object using load() after inserting modified exif, I'm getting this error:
Uncaught 'unpack' error. Mismatch between symbol and string length. 2:0.
If I just take the inserted jpegData and create a blob out of it, some of exif data becomes corrupted:
Before:
After:
Here is the code that I used:
function modifyOrientation(file) {
var reader = new FileReader();
reader.onload = function(e) {
var origDataUrl = e.target.result;
var exif = piexif.load(origDataUrl);
console.log(exif);
exif['0th'][piexif.ImageIFD.Orientation] = 1; // modifying orientation
var dump = piexif.dump(exif);
var inserted = piexif.insert(dump, origDataUrl);
var modifiedExif = piexif.load(inserted); // <== error thrown here
console.log(modifiedExif);
debugger;
};
reader.readAsDataURL(file);
}
and here is the sample image:
The text was updated successfully, but these errors were encountered:
Thanks for the work,
I want to modify exif orientation, which I'm able to do for most images, but for some images some exif data (like "Make", "Model", "X-resolution", "Y-resolution") gets corrupted or lost.
So I tried to compare exif objects before and after modification on those problematic images, but when I try to get exif object using
load()
after inserting modified exif, I'm getting this error:Uncaught 'unpack' error. Mismatch between symbol and string length. 2:0
.If I just take the inserted jpegData and create a blob out of it, some of exif data becomes corrupted:
Before:
After:
Here is the code that I used:
and here is the sample image:
The text was updated successfully, but these errors were encountered: