-
Notifications
You must be signed in to change notification settings - Fork 125
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
skip non png files, if --recursive
is used
#548
Conversation
Thanks for this! Again, I would prefer not to add the extra option for including non-png, it seems like unnecessary clutter. It's true that globbing was problematic on Windows, but this has been resolved now. [edit] It may also be best to do case-insensitive comparison on the extension, to include |
I am not sure, what you mean with this. If the user does not use the the
I do not think that the current behavior is expected from the user. |
Right, but if I were to run
Yes, I agree 🙂. I'm referring to the new option |
Yes you are right, I did not pay attention to the fact that the user can still pass files instead of folders.
I agree to this. It was suggested by @TPS. @shssoichiro should decide if he wants this flag or not. |
--recursive
is used--recursive
is used
Cool. I'd suggest you keep it out for now and only add it back in if @shssoichiro asks. |
The advantage to the add'l option (& current behavior) is that a PNG-format file, whatever the extension, will still be analyzed & potentially optimized. I agree this may be a rare event nowadays (though, AFAIK, *nixs never enforced extensions on their native filesystems/-types, so I expect more problems there), but that's why it'd be a suboption. Globbing on Windows is a whole other whack-a-mole problem. It's fine until an edge case is found where the included glob library fails. Those on Windows are used to having options (in place of globbing) for anything that's not selecting a subset of files (& sometimes even then, just to avoid glob). I actually missed the reasoning why the current behavior should be changed, but leaving an suboption to keep it shouldn't hurt anything, & is currently useful. |
@TPS Appreciate the input! Having endless options, even very simple ones, ultimately does end up hurting though. It can become a maintenance burden if options need to interact in some way, or simply cause more work during a refactor. It can also just be a visual clutter when working with the code, not to mention clutter for the users reading the docs and trying to understand all the options. It may seem harmless adding an option or two here or there but they do build up over time and can end up becoming a confusing mess. I believe it's important to carefully consider new options and avoid adding any unnecessarily, such as where there's an easy alternative (which is the case here) or where there's been no demonstration of an actual need (also the case here - you've mentioned a hypothetical but this isn't actually a use case you're personally encountering, is that right?). Again though, these are just my opinions. @AlexTMjugador or @shssoichiro may think differently 🙂 (@TPS off topic, but I'd be interested to know what is your use case with oxipng 😄) |
@andrews05 By this argument, this whole RFE & discussion is irrelevant: leave things as they are, because there's no evidence there's currently a problem, or any benefit to this change. (OT: As you might've read elsewhere, I'm a huge proponent of FileOptimizer. But it's often overkill & takes so much time. Much of the time, I can get away w/ Compress-or-Die.com. If that's not good enough for PNG, I generally convert there to lossless WebP/JxL. But, if I need PNG, better than CoD, & faster than FO, OxiPNG is my current goto.) |
@LuckyTurtleDev I'll convert this to a draft for now, you can mark it for review when ready. |
I think that a
In my view, what @andrews05 was trying to communicate is that, while some users may get some minor benefit from adding this option, in the grand scheme of things, when considering detailed design, maintenance and project scope, that minor benefit may be offset by costs. This is not advocating for "leaving things as they are because there's no evidence", but admitting that some tasks are better dealt with by the users themselves, which know exactly what they are up to. And in this case, I agree that a |
@LuckyTurtleDev We should also include files with |
Who knows how many more extensions? |
Wikipedia knows 🙂 |
Hi @LuckyTurtleDev, thank you a lot for this PR! ❤️ We'd like to move forward with the next OxiPNG release and I think this PR could make it into such a release, but I notice it's on a draft status and there are some pending concerns. In my view, the removal of the |
@AlexTMjugador I think everythink should be ready now. Some should review the changes. I have not test this yet. |
--recursive
is used--recursive
is used
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.
Looking good @LuckyTurtleDev! Just left a couple of comments.
I'd also suggest updating the help for the flag. Something like:
Recurse into subdirectories and optimize all *.png/*.apng files
Co-authored-by: andrews05 <andrew@digerati.co.nz>
Co-authored-by: andrews05 <andrew@digerati.co.nz>
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.
I think this is good to go, thank you!
Fix #547
Files with non
png
extensions are skipped now, if the--recursive
flag is used.If
--recursive
is not used nonpng
files "can" still be compressed.How @TPS has suggested I have also add an flag, to keep the current behavior.
I am not sure if
--include-non-png
is the best name for this.Please squash merge.
TODO:
--recursive
is used #548 (comment))apng
extension--include-non-png
flag?