-
Notifications
You must be signed in to change notification settings - Fork 502
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
Micropython jpegdec::get_width()/get_height() will always return 0 #894
Comments
You're right- PNGDEC rectifies this (and avoids the need for close) by opening the file to grab the width/height and store it on the Python object instance- pimoroni-pico/micropython/modules/pngdec/pngdec.cpp Lines 292 to 321 in bff2453
This pattern was never backported to JPEGDEC, but probably should be. |
I've changed #895 to backport the PNGDEC fix, adding width/height to the _JPEG_obj_t and setting those on open(), creating a helper function |
fixed by #899 |
Due to the
// Just-in-time open of the filename/buffer
, get_width and get_height will always return 0 as the jpeg is never actually loaded when these functions are called. This means the user cannot check the size of the jpeg and change the x/y/scale when decoding it based on the size.This should probably be fixed by loading the jpeg at the time of calling
open_file()
oropen_RAM()
, which would also want aclose()
function.The text was updated successfully, but these errors were encountered: