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

Corrupted images are not handled properly #27

Closed
2 of 7 tasks
flozz opened this issue Sep 22, 2022 · 2 comments
Closed
2 of 7 tasks

Corrupted images are not handled properly #27

flozz opened this issue Sep 22, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@flozz
Copy link
Owner

flozz commented Sep 22, 2022

Bug description

What happened

If there is a corrupted image when dropping a bunch of file on the app window, the import process crash and other images are not imported.

What was expected

When a corrupted image is imported,

  • the app must continue importing other image after encountering the corrupted one
  • and at the end of the import, a message should warn the user about the corrupted image(s)

Step to reproduce

  • The bug is always reproducible
  • The bug seems to appear randomly

Steps to reproduce:

Just drag & drop some image with one corrupted.

System information

  • Operating system (with version): Ubuntu 22.04

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer)
    • From source
    • Windows Installer
    • Windows Zip
    • Other: working from the master branch
  • YOGA Image Optimizer version: master (c60c29a510716cdb603d12f6e668d4b767b8b622)

Stack trace:

Traceback (most recent call last):
  File "yoga_image_optimizer/main_window.py", line 422, in _on_drag_data_received
    _add_path([path])
  File "yoga_image_optimizer/main_window.py", line 417, in _add_path
    app.add_image(path)
  File "yoga_image_optimizer/application.py", line 183, in add_image
    preview=helpers.preview_gdk_pixbuf_from_image(image),
  File "yoga_image_optimizer/helpers.py", line 92, in preview_gdk_pixbuf_from_image
    image_rgba.paste(image)
  File "__env__/lib/python3.10/site-packages/PIL/Image.py", line 1617, in paste
    im.load()
  File "__env__/lib/python3.10/site-packages/PIL/ImageFile.py", line 276, in load
    raise_oserror(err_code)
  File "__env__/lib/python3.10/site-packages/PIL/ImageFile.py", line 71, in raise_oserror
    raise OSError(message + " when reading image file")
OSError: broken data stream when reading image file

Related issue: #14

@flozz flozz added the bug Something isn't working label Sep 22, 2022
@flozz flozz self-assigned this Sep 28, 2022
@flozz
Copy link
Owner Author

flozz commented Sep 28, 2022

Corrupted images do not crash the app at import time and are now displayed with a "broken image" thumbnail:

image
image


We should now handle errors that occur during the optimization process as broken images are no more "filtered" by a crash during the thumbnail generation... :)

@flozz
Copy link
Owner Author

flozz commented Sep 28, 2022

Errors are now handled on optimization too:

image

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant