Bug 237895

Summary: createImageBitmap() from Blob loses exif orientation
Product: WebKit Reporter: Andrew Swan <aswan>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, heycam, karlcow, mail+github, sabouhallawa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case
none
Safari vs Other browsers none

Andrew Swan
Reported 2022-03-15 08:20:08 PDT
Created attachment 454708 [details] test case See attached test case -- this test uses a jpeg that contains an exif header indicating that the image should be rotated 90 degrees. When displayed via an <img> tag the image shows up at the correct orientation, but when displayed by decoding with createImageBitmap() and then drawing the resulting image to a canvas, the image is not correctly rotated. Although not covered by the test case, if an ImageBitmap is created with an ImageElement as the source, the orientation is handled correctly.
Attachments
test case (2.54 KB, text/html)
2022-03-15 08:20 PDT, Andrew Swan
no flags
Safari vs Other browsers (237.98 KB, image/png)
2024-05-21 05:37 PDT, Ahmad Saleem
no flags
Radar WebKit Bug Importer
Comment 1 2022-03-16 05:42:20 PDT
Ahmad Saleem
Comment 2 2024-05-21 05:37:15 PDT
Created attachment 471462 [details] Safari vs Other browsers It looks all browsers are rendering this same.
Alexander
Comment 3 2025-02-20 08:26:00 PST
Just wanted to see if there are any updates on this one? `createImageBitmap` has been around for a while, but because of various bugs it's still hard to use (this is one of them). A few examples of use-cases for `createImageBitmap`: - Crop images on-device - Resize images on-device before uploading to a server - For example a photo from `<input type="file" capture="environment">`. - On-device image resize has long been problematic, with the main workaround being the Canvas element, but every implementation I've seen has been buggy or hard to use, for example due to iOS canvas memory limits. - Take snapshots from a video feed - Extract sprites from a sprite sheet - Take non-rotated image pixels with an associated EXIF tag and output rotated pixels (without any EXIF), or put differently strip EXIF and apply rotation to image data. - This is useful since many server-side systems prefer to handle all images without accompanying exif rotation data.
Note You need to log in before you can comment on or make changes to this bug.