![]() ![]() The top item (imagemagick + imageoptim) was my baseline (that’s what I was using in my bash script). png file, resize it, then optimize it (note that these times are for all those actions, not just the optimization aspect): Tool What you see below is a comparison of tools and how long it took each one to take a source. What makes it good for testing? There’s a lot going on in that PNG so compression takes a long time. Once I had a couple tools for consideration, I found a good icon to test against. I discovered a couple tools in npm that claimed to do lossless compression, so I tested them out (FWIW I also tested out the lossy compressor PNGQuant which was insanely fast in comparison, but the image quality was severely degraded – go figure). ![]() That’s essentially why I had been doing lossless compression the entire time (plus it was just the default for the Mac app). Because the entire “raison d'être” of the icon gallery sites is to showcase the beautiful artwork of icons, I didn’t want to sacrifice image quality for better compression. imageoptim for Mac does lossless compression, which means larger file sizes but better image quality. The major axis of differentiation (at least to me in this case) are tools that do lossy vs. To be clear, there are a number of options out there. But I wanted to benchmark possible node-based tools out there to see how they compared for image compression. Not slow in a bad way, granted, because it’s doing lossless compression. The imageoptim tool for Mac is fantastic the one drawback is that its kinda slow. Image Manipulation Options for NodeĪs mentioned, I was previously using imagemagick to resize images and imageoptim to optimize them (both triggered via CLI commands). So that’s what led me to the following rabbit-hole of research and comparison. This would be easier to setup and control if I used node-based tools available on npm. I could, say, just POST to a URL with the iTunes app link (and any extra metadata) and my post would be created automagically by some server in the cloud. Then I don’t have to open my laptop to create a post. But I’ve wanted to get to a future where the code that creates a post could, conceivably, be run as a lambda. In the past, I’ve really only ever run this code on my own laptop so I could ensure imagemagick and imageoptim were installed on my computer and available. In addition to not writing bash scripts anymore, I wanted to migrate this logic to node so that I didn’t have to rely on specific CLI tools being installed on the computer running this code. ![]() # At this point, I now have a `title-of-post.md` file and a `icon.png` file # Now I create a number of variations of the source `icon.png` file for file in *.png do # resize with imagemagick # optimize with imageOptim done # Move to appropriate locations, commit, and push the changes sh file which looked (simplistically) like this: # Fire my node script for adding an icon to my gallery Previously, I was using imagemagick and imageoptim on my local computer to resize and optimize each icon before committing it to git.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |