5

With Chrome 81 and other new releases, EXIF orientation is observed by default and image-orientation: from-image is obsolete (see SO thread and test site).

Now when loading a JPEG from a file, can this be used, too? I do get wrong rotation but when loading the same image via url into an image-tag, it comes out correct.

var r = new FileReader();

r.onload = function(e) {
    var img = new Image();

    img.onload = function() {
        var width = img.naturalWidth,
            height = img.naturalHeight;
        // does not observe EXIF image orientation
    };

    img.src = src;
};

r.readAsDataURL(file);
Benjamin E.
  • 5,042
  • 5
  • 38
  • 65

0 Answers0