-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Improves handling of Gcode Thumbnails #27947
Improves handling of Gcode Thumbnails #27947
Conversation
This comment has been minimized.
This comment has been minimized.
0876339
to
24f6b87
Compare
24f6b87
to
80254ff
Compare
I would argue that the Peek support doesn't bring that much value as these thumbnails are normally 128x128 or less, so we end up with a small image shown on Peek! However, g-code files have a lot more metadata than just the thumbnails, so if Peek preview had a Property Grid of sorts, we could show that metadata as key value pairs... just a thought for further enhancement! 😉 |
Following up on my previous comment, I see I was incorrectly adding Peek support via ImagePreviewer in this is no image, so I have reverted and removed those changes from the PR. |
I've just added #27979 to allow Peek to show not only Gcode thumbnails, but also any file that has a thumbnail! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the contribution!
Blocking until .74 while we figure out how to audit the new dependency ;)
@jaimecbernardo if the WTFPL license is an issue, there are a couple of other NuGet packages that are MIT based, maybe I should check those instead? Alternatively, I can try pulling a QOI implementation into PowerToys... |
What alternate packages do you have in mind? |
I found at least 2 potential candidates on NuGet: I haven't tested any of these, but at least the license is MIT! |
How much code would this bring in? If not much, this might be the best option. The reason is that all of these packages have a small number of downloads, and not sure how stable are those |
With the WTFPL license, I'm thinking this could be a git submodule, so we can be sure of the code we are bringing in. |
I will take a look at one of the other MIT licensed QOI implementations and see if I can get my code to work with theirs; if so, I expect it to be one or two files tops to bring into PT, so might that be workable? |
That would be an interesting way of doing it, as well. I'm planning on making the current dependency into a git submodule after I do the current round of reviews :) |
FWIW, I've now removed the QOI.Core dependency and replaced it with my very own custom implementation of a QOI decoder based on the (MIT licensed) reference code! I've tested it against the sample images from https://qoiformat.org/ and worked fine (the "*.qoi.png" files on this screenshot are the output of my decoder): |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5f6389f
to
537a726
Compare
Hi @pedrolamas , thanks for the changes :) |
Correct, this is my own translation of the official reference code: I added a small disclaimer on top of the QoiImage.cs file, pointing to the reference code file. Side note: once this PR gets merged, I might look into adding support for QOI Explorer thumbnails and Peek Preview support! |
This comment has been minimized.
This comment has been minimized.
Can you link me to their license md? |
Lemme do the notice tweak and will call out it is a port too by Pedro |
FYI, This is what's already on the PR in NOTICE.md under "File Explorer add-ons":
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for the contribution!
Just waiting on @crutkas OK for the Notice.md changes and then we can merge 😉
tweaked notice a bit
i tweaked it a bit, @pedrolamas did great and on inspection, it would have been truthful. |
Summary of the Pull Request
This PR adds improved handling of Gcode Thumbnails that include JPG and QOI image formats
, and also adds Gcode files support to Peek.PR Checklist
Detailed Description of the Pull Request / Additional comments
PowerToys already had support to show PNG thumbnails found in Gcode files as File Explorer thumbnails or on the preview pane.
As Prusa Slicer recently added JPG and QOI image formats to the output Gcode, this PR adds support for those 2 new image formats.
The QOI image format support is added via QoiImage, a custom QOI decoder I wrote based on the reference code.
I've refactored the Gcode parsing related code and moved it to PreviewHandlerCommon.
Validation Steps Performed
Manual testing on my local machine mostly, but I also updated the
UnitTests-GcodePreviewHandler
andUnitTests-GcodeThumbnailProvider
tests