ritwikraha / Open-Generative-Fill

A repository for hacking Generative Fill with Open Source Tools
MIT License
32 stars 3 forks source link

Testing Colour Change of Objects and Ensuring Content Decoding for Image Loading #4

Open TheHappyBaloney opened 8 months ago

TheHappyBaloney commented 8 months ago

This pull request addresses an issue encountered while testing color modification functionality in the image editing tools. Upon investigation, it was found that the load_image function lacked explicit content decoding, potentially leading to errors when retrieving and opening images from URLs.

To resolve this, updates were made to the function to ensure proper decoding of content retrieved from the URL before opening the image with Pillow. Additionally, the original image used for testing, featuring a red apple, has been included along with the successful conversion to a green apple, as demonstrated in scratchpad.ipynb. This change enhances the reliability of the image-loading process and ensures smoother functionality within the editing tools.

ritwikraha commented 8 months ago

Thanks for this PR, can you share a notebook or an example of what kind of errors you faced while loading images?

TheHappyBaloney commented 8 months ago

Apologies for the delayed response. While loading the image there was an "UnidentifiedImageError". Following is the error text :

/usr/local/lib/python3.10/dist-packages/PIL/Image.py in open(fp, mode, formats) 3281 warnings.warn(message) 3282 msg = "cannot identify image file %r" % (filename if filename else fp) -> 3283 raise UnidentifiedImageError(msg) 3284 3285

UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x78ef97f798f0>

While researching about the underlying issue behind this error, I used Github Copilot Chat which suggested the changes in load_image function, doing which, the code worked flawlessly.