Closed montehurd closed 5 months ago
Hi @montehurd, this is an interesting topic that has come up a few times. See #549, #564 and #566. The problem is that everyone has a slightly different use case and a different idea of how it should be achieved. To quote one of my previous responses: This is a great feature for a wrapper application/script that invokes oxipng under the hood and we encourage users who would like such a feature to explore doing it this way.
Looking at the PR you linked to, it looks there already was a wrapper script that did what you're suggesting?
I'll close this as a duplicate, but feel free to add your ideas to the thread in #549.
Thanks @andrews05
That makes sense
Quick question - is the stdin input option working?
I tried to adapt my previous wrapper script logic to pipe the list of yet-to-be optimized image paths to oxipng's stdin, with the hope oxipng could take that list and still manage spawning optimization threads across cpu cores, but I couldn't even get a single image to be optimized via stdin... wondering if maybe stdin functionality is currently broken?
Ah, the stdin doesn't take a path list sorry, it takes the content of a single png directly (intended for piping). You might have to use xargs or something to process a path list. [edit] If accepting a path list as stdin would a useful feature, feel free to open a new request for that.
@andrews05
Is there a way to make oxipng bail more quickly on images it has already optimized?
Could perhaps a flag be added which causes oxipng to write a eXIf Comment (perhaps set to "OptimizedByOxipng"?) to pngs upon being successfully optimized by it?
The flag would also cause oxipng to check for that eXIf Comment's presence in images, so it could bail more immediately upon detecting it
Maybe the flag could be called a variant of
--flag-and-skip-optimized
?Context:
I'm using this once daily in my Docker container:
CMD ["oxipng", "--fix", "--recursive", "-o", "2", "."]
My dir has many subdirs with thousands of images
A fraction of these screenshot images are re-captured daily
I love the simplicity of just running oxipng recursively, especially given how effectively it utilizes available processor cores
But it would be amazing if it could devote less time to already optimized images without the user having to determine the subset of images which have yet to be optimized
Thanks for consideration and any feedback!