Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@speee/iiopt

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@speee/iiopt

(iikanji ni)nice image optimizer

latest
Source
npmnpm
Version
0.4.0
Version published
Weekly downloads
5
-44.44%
Maintainers
2
Weekly downloads
 
Created
Source

iiopt

iiopt is a npm package that reduces the sizes of images by compressing them using pngquant and mozjpeg. The compression levels in these tools are fixed to 85.

Install

Iiopt requires Node 8 or later.

iiopt needs imagemagick. In MacOSX, you can install them by using HomeBrew.

brew install imagemagick

Then, install @speee/iiopt using npm:

$ npm install @speee/iiopt

Usage

$ iiopt --help
  (iikanji ni)nice image optimizer

  Usage
    $ iiopt <file>
    $ iiopt <file> --out-dir <output>
    $ iiopt --install-git-hooks
  Option
    --install-git-hooks, install script that hooks git pre-commit to compress image automatically
    --overwrite, -o  overwrite images
    --apply-new-files, compress images before git commit.
    --detect-new-raw-images-from, detecting new raw images in a current working branch.
  Example
    $ iiopt images/sample.jpg --out-dir ./compressed # compressed images, and the results are stored into ./compressed directory
    $ iiopt foo.png -o # overwrite foo.png with compressed image

iiopt --install-git-hooks

iiopt --install-git-hooks command embed the following script into the git pre-commit hook.

#!/bin/sh -e
npx iiopt --apply-new-files

iiopt --apply-new-files is a command that compress png and jpg images stored in the git staging area.

Notice: Currently, also compressed images were recompressed when these were staged. If you want to commit already compressed images, use git commit --no-verify to skip the git pre-commit hook.

Detecting new raw images in a current working branch.

iiopt also has a feature that detects unoptimized images in a current working branch. The feature is run by the following command.

iiopt --detect-new-raw-images-from=${branch}

For ${branch}, you enter the name of the branch to which you want to merge.(ex master, development)

Images

Sample images in this repository are copied from below sites. They are royalty-free.

License

This repository is under the MIT License.

Keywords

image

FAQs

Package last updated on 07 Feb 2018

Did you know?

Socket

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.

Install

Related posts