
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
imageoptim-cli
Advanced tools
Automates ImageOptim, ImageAlpha, and JPEGmini for Mac to make batch optimisation of images part of your automated build process.
Automates ImageOptim, ImageAlpha, and JPEGmini for Mac to make batch optimisation of images part of your automated build process.
While other image optimization tools are available from the command line, ImageOptim-CLI exists because the current benchmarks suggest that ImageOptim, ImageAlpha and JPEGmini currently outperform those alternatives over lossless and lossy optimizations.
ImageOptim-CLI is written in TypeScript and AppleScript but is distributed as a self-contained executable binary, you don't need Node.js installed to use ImageOptim-CLI.
Check out this short video demo of ImageOptim-CLI to see how it works.
npm is the recommended way to install ImageOptim-CLI as it is the most convenient.
npm install -g imageoptim-cli
Otherwise, you can install manually by downloading the latest zip then adding ImageOptim-CLI to your $PATH.
curl --output imageoptim-cli.zip https://registry.npmjs.org/imageoptim-cli/-/imageoptim-cli-2.0.0.tgz
unzip imageoptim-cli.zip
export PATH=$PATH:imageoptim-cli/bin
Saving somewhere in your home directory such as
~/imageoptim-cli
is recommended, but not essential. Saving to/Applications
is not recommended, do not do this.
$ imageoptim --help
Usage: imageoptim [options] [patterns...]
Options:
-V, --version output the version number
-a, --imagealpha enable ImageAlpha
-j, --jpegmini enable JPEGmini
-C, --no-color output to the terminal without colors
-I, --no-imageoptim disable ImageOptim
-Q, --no-quit do not quit apps once finished
-S, --no-stats do not display file size savings and quality loss information
--number-of-colors <n> ImageAlpha palette size, defaults to 256
--quality <min>-<max> ImageAlpha quality range from 0-100, defaults to 65-80
--speed <n> ImageAlpha speed from 1 (brute-force) to 10 (fastest), defaults to 1
-h, --help output usage information
Supported Apps:
ImageAlpha: https://pngmini.com
ImageOptim: https://imageoptim.com
JPEGmini Lite: https://itunes.apple.com/us/app/jpegmini-lite/id525742250
JPEGmini Pro: https://itunes.apple.com/us/app/jpegmini-pro/id887163276
JPEGmini: https://itunes.apple.com/us/app/jpegmini/id498944723
Examples:
Run ImageOptim.app over every image in current directory
imageoptim
Run ImageAlpha.app and ImageOptim.app over every PNG in current directory
imageoptim --imagealpha '**/*.png'
Run ImageAlpha.app and JPEGmini.app over every JPG in current directory
imageoptim --jpegmini '**/*.jpg' '**/*.jpeg'
Run ImageOptim.app over every image in a specific directory
imageoptim '~/Desktop'
You may be presented with the following message the first time you run ImageOptim-CLI with the
--jpegmini
flag.
To automate JPEGmini we need to add Terminal.app (or iTerm.app etc) to the 'support for assistive devices' whitelist.
The JPEGmini OS X Apps don't include a command line API, so a real user is simulated by entering synthetic clicks and keyboard commands instead. This requires your permission and is easily set up in System Preferences as shown by these guides.
The ImageOptim-CLI Grunt plugin is grunt-imageoptim.
ImageOptim-CLI features in this comparison of the performance of image optimisation tools alongside Kraken.io, CodeKit, grunt-contrib-imagemin, Smush.it, and TinyPNG.
How Optimized Are Your Images? Meet ImageOptim-CLI, a Batch Compression Tool
The ImageOptim-CLI Workflow for Alfred app is alfred-image-optim-workflow
You will need to install these applications separately.
The CLI, ImageOptim and ImageAlpha are all free. JPEGmini is a paid-for product but you can use ImageOptim-CLI and choose not to run JPEGmini.
WebP looks great and may well overtake the formats handled by ImageOptim-CLI, but converting images to WebP is outside ImageOptim-CLI's chosen remit.
JPEGmini does this today, but for ImageOptim and ImageAlpha I feel a feature like this belongs in those applications rather than this automator.
Optimising images is a pretty intensive process, so instead of optimising one image at a time (which would take forever) — ImageOptim optimises many images at the same time until all of them are done.
A side effect of this is that the fans come on at full power to keep your machine cool while it's maxed out.
ImageOptim-CLI uses ImageAlpha's internal installation of pngquant so it's normal that nothing is shown on screen.
It's also possible that if you look in the Activity Monitor
you will not see pngquant
displayed but it is being run. In my experience it's only when you run
ImageOptim-CLI on a very large number of PNGs that you have enough time to spot it. ensure that
Activity Monitor's Update Frequency is set to Very Often (1 sec).
Yes.
Performing the in-app upgrade leaves the app named as jpegmini-lite, so ImageOptim-CLI can't determine whether it's the free or full version. It is better to instead buy the full version of JPEGmini separately.
See this tutorial on how to manage Accessibility preferences and GUI Scripting. In the case of OS X Mavericks, you will want to add the Applications JPEGmini and Terminal (or equivalent such as iTerm).
ImageOptim-CLI is responsible for automating 3 OS X applications so is inherently bound to OS X for that reason.
It would first require ImageOptim, ImageAlpha, and JPEGmini to be available for those platforms.
@addyosmani wrote a really thorough article on tools for image optimization which discusses a wide range of options in great detail.
There are few ways to get help:
Have an idea? Found a bug? Please see the Contributing Guide for information on how to install the project and start writing code.
FAQs
Automates ImageOptim, ImageAlpha, and JPEGmini for Mac to make batch optimisation of images part of your automated build process.
The npm package imageoptim-cli receives a total of 9,534 weekly downloads. As such, imageoptim-cli popularity was classified as popular.
We found that imageoptim-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.