cmu-cs-academy / desktop-cmu-graphics

BSD 3-Clause "New" or "Revised" License
15 stars 9 forks source link

Add an openImage function that can open PIL images and download from http #77

Open Mohamed-Waiel-Shikfa opened 3 months ago

Mohamed-Waiel-Shikfa commented 3 months ago

Added openImage to more easily open PIL images. These images can then be manipulated by PIL library and transformed into a CMUImage like usual.

Mohamed-Waiel-Shikfa commented 2 months ago

This now works perfectly and passes all the tests. If merged could really help students working with images, as it's now only a matter of calling a function without having to worry about file path etc, potentially making

unnecessary or at least easier to finish.

It could also help in other part of cmu_graphics source code where images are being handled

I am not sure if the function needs to be translated somewhere and if it needs to be included in the import of __init__.py, but I am open for feedback and would be happy to integrate any necessary change to see this feature merged.

TL;DR this function aims to expose the loadImageFromStringReference function present in shape_logic.py to the user

, and to thus replace it in some way

Mohamed-Waiel-Shikfa commented 2 months ago

I need some help on this one. The test is only failing for macOS zip install, which is weird, and I cannot test locally to debug. I am also not sure what the difference between the pip and zip installs are, but pip test succeeds on both platforms.

@schmave mind taking a quick look on this when you have the time. Also, quick mention, the other 3 PR are now ready for review.