Closed diceroll123 closed 4 years ago
Good idea, I'll have to see what's possible. Python doesn't have type checking though. Also should it be another method with an Image
parameter instead of path param?
As for path,I'm not sure what you mean, the library already does use pathlib for universal path support.
Python does indeed have type checking! See: https://docs.python.org/3/library/functions.html#isinstance example: isinstance('blah', str)
My suggestions would be to change src_img_path
to something a little more generic (i'll be calling it new_image_path
for example's sake), validate it as a path if it's a string, and if it's a file-like object, isinstance(new_image_path, io.IOBase)
(after import io
of course) would return True. Image.open(new_image_path)
will work if the file-like object is an image.
You'd have to change the RGB/RGBA conversion though since it relies on the file path ending in .png
, so you'd first have to open the image, check the file type using src_img.format
Ah, I think I misspoke when I mentioned Path support. Freudian slip or somethin', disregard that! 😅
Thanks! Will be working on this after adding GIF glitching support. One question, I'm not sure what you mean by this
You'd have to change the RGB/RGBA conversion though since it relies on the file path ending in .png, so you'd first have to open the image, check the file type using src_img.format
The glitching should work regardless of it being .png
or some other format, do you mean, that in case of an Image
input, I'd need to check src_img.format == 'PNG'
instead of src_img_path.endswith('.png')
?
Correct, the latter! 😎
Gif glitching sounds awesome, can't wait.
@diceroll123 Just added in v0.0.8! Along with GIF support and much more, enjoy!
Please let me know if you encounter any bugs as well!
Hypothetically if I were to already have a file's path opened in an object, I could just pass it through without having to save first. If I were strictly not working with local files, this would be ideal.
without making another Issue, Path support would be nice as well