-
-
Notifications
You must be signed in to change notification settings - Fork 391
Add options to reduce image quality to fix thumbnails on TJC displays #998
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
Conversation
- Runout icon indicator over the Extruder flow dashboard icon. - Dashboard Speed shows the current axes speed in mm/s intermittently with the speed percentage - Enhanced preview with arbitrary thumbnail size - Preview QR code removed for improve support with some display units - Improved 3D/BL/CRTouch auto leveling - Enable BLTouch HS mode for bed tramming wizard - Set Multiple probing to 0 as default - Better limits for mesh insets editing - New C35 custom g-code for launch the bed tramming wizard. - Added toolbar option for park head. - Force axes homing to allow parking at pause - Raise Z when printing is aborted - Fix a possible bug with filename drawing in printing page - Fix Crash after removing SD card mriscoc#894 - Several minor bug fixes and Misc. optimizations - and many more fixes from latest Marlin's bugfix 2.1.x In source: - TJC support to enable preview and grid mesh viewer - Added Creality CV laser module support with automatic file type detection - Added Creality Cloud Support - Menu items value faster/smooth change rate - More #define flags to disable features to help to reduce code size - Many improvements from the latest Marlin's bugfix sources
Changed download tool
Updated download tool
- Filament Runout: better source code compatibility - Do not present the bed after canceling the print if the position of the axes is unknown - Require a PROBING_MARGIN of 10 if PROUI_EX is enabled - Updated thumbnail demo G-code files - Small bug fixes
Update user gallery
I like the additional option, but since there is only one additional option at the moment, perhaps it could be displayed without the need to use the checkbox. Maybe a line separator between the normal options and the "extra" option. |
I hid it behind a checkbox, so one can opt to not reduce the quality of the produced image. I could not find a way to leave the box empty by default, except with using a string box (but that has its own problems, like allowing invalid input). Ideally I would like to have it set to <20kb by default, so for all TJC users (who most likely do not read the wiki that thoroughly) the thumbnails will just work. Would you mind telling me how to add a line separator? The documentation and examples are quite limited for cura plugins. (Maybe I haven't found the right page yet) |
Maybe the attached file can help, sorry I couldn't find a newer version. |
I added a bit more code to speed up the search for an optimal thumbnail size. Before it started at a quality of 95 and then reduced it, until the produced image had a size less than the maximum thumbnail size. The algorithm is simple, but slow, especially in the worst-case scenario: When the image is set to a very low value like 100 bytes (which no image could possibly satisfy), it tries all qualities from 95 to 1, so the snapshot is encoded 95 times. The new one will only need to encode the image ~6 times in the worst-case scenario (log_2(n) runtime for binary search): The algorithm works like this:The image qualities are proportional to the image sizes and this can be used to find For example when the size should be 15kb, one starts with the middle of the list of possible image qualities ( Then the quality is halved again ( |
5496c1d
to
6ce3545
Compare
Merged aeae59a |
Thank you 🎉 |
Description
This PR changes the thumbnail generation script for CURA. It adds an option to set the maximum size of the generated thumbnail in bytes. It then lowers the quality of the generated thumbnail until the size is less than the maximum size.
For TJC displays the dimensions must be exactly 200x200px and the generated thumbnail should
not be larger than 20kbytes. Sometimes the script made thumbnails that were larger than the 20kb, which resulted in an error about "missing thumbnail" on my Ender 3 S1.
I hid the option behind a checkbox, so the quality is only lowered when the option is set:



(by default the maximum size is set to about 15kb, if the box is checked)
Requirements
Benefits
Configurations
Related Issues
This might be related to #990.