Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ImageBitmap => ImageData on the main thread in all browsers #36

Merged
merged 1 commit into from
Jun 4, 2022

Commits on Jun 4, 2022

  1. Convert ImageBitmap => ImageData on the main thread in all browsers

    Chrome has a bug where image orientation metadata in JPEG images is lost
    when an ImageBitmap is cloned via a structured clone [1]. Therefore we have
    to do ImageBitmap => ImageData conversion on the main thread to ensure
    that the OCR engine receives decoded image data which respects the image
    orientation.
    
    Prior to this fix the rendered image orientation and the OCR output did
    not match up in Chrome if the input image was rotated.
    
    Since neither Firefox nor Safari support OffscreenCanvas, this means
    that all browsers are now doing ImageBitmap => ImageData conversion on
    the main thread.
    
    Fixes #35
    
    [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1332947
    robertknight committed Jun 4, 2022
    Configuration menu
    Copy the full SHA
    c5a8592 View commit details
    Browse the repository at this point in the history