Kilian / Trimage

A cross-platform tool for optimizing PNG and JPG files.
http://trimage.org
MIT License
706 stars 55 forks source link

safe mode #55

Closed unhammer closed 5 years ago

unhammer commented 5 years ago

This seems like a very nice tool, but it feels a bit dangerous since it's so easy to overwrite originals. How about a "safe mode" where you always create a new file, named e.g. basename+".trim."+suffix (or using a subdir "trimmed/"+basename+suffix)?

Kilian commented 5 years ago

Hey! That doesn't fit with the usecase for Trimage. It's for quick and easy minification of images for use on the web. That means that the only thing that matters is that the resulting image is smaller, and it shouldn't introduce additional steps like manually comparing and renaming. If that's something you want, you probably don't want to use it for the primary use case of minifying images for web.

The image compression is (visually) lossless and it will only overwrite the original if it's actually smaller (it almost always is, though there are some handwritten png-8 files that the compressors actually enlarge). It's destructive when it comes to the metadata of an image, which you never need in web images.

bittner commented 3 years ago

While what you describe is true for the primary audience and use case, it would be helpful to allow to keep the original around if I really want to. Call it "advanced options", or options for advanced users. :rocket:

That would really help. It scared me to death when I figured out that the images that I used for trying out Trimage for the first time were actually modified in-place! :astonished: