Socket
Socket
Sign inDemoInstall

lipo

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

lipo

Free image manipulation API service built on top of Sharp (an alternative to Jimp, Graphics Magic, Image Magick, and PhantomJS)


Version published
Weekly downloads
12
decreased by-65.71%
Maintainers
2
Weekly downloads
 
Created
Source

lipo


Lipo is a free image manipulation API service built on top of Sharp
Need an alternative to Jimp, Graphics Magick, ImageMagick, or PhantomJS? • Built by @niftylettuce and contributors

Lipo is a cross-platform and drop-in replacement for Sharp

Table of Contents

Install

npm:

npm install lipo

yarn:

yarn add lipo

Usage

To keep things simple you can use the exact same API that Sharp offers.

const Lipo = require('lipo');
const lipo = new Lipo();
lipo('input.jpg')
 .resize(300, 300)
 .toFile('output.jpg', err => {
   if (err) throw err;
   console.log('resized image');
 });

Lipo is a drop-in replacement for Sharp (so you won't have to worry about cross-platform installation).

You can simply replace instances of sharp with lipo:

-const sharp = require('sharp');
+const Lipo = require('lipo');
+const lipo = new Lipo();
-sharp('input.jpg')
+lipo('input.jpg')
  .resize(300, 200)
  .toFile('output.jpg', err => {
     if (err) throw err;
     console.log('resized image');
  });

Synchronous Methods: We have also exposed three helper functions toBufferSync, toFileSync, and metadataSync. These are not included in Sharp's API, however we included them since they were needed for our project custom-fonts-in-emails. You can use these if you need to run purely synchronous operations. They use the deasync package under the hood!

Rate Limiting

Note that if you use make more than 100 requests per hour from the same IP address or wish to exceed 20MB file upload size limitation, we will rate limit you until you sign up for an API key at https://lipo.io.

Once you sign up for a key, you can pass it as const lipo = new Lipo({ key: 'YOUR_API_KEY_HERE' }); or as an environment variable (e.g. LIPO_KEY=YOUR_API_KEY_HERE node app.js).

Background

While building Lad I was instructing our team how to install Sharp, but there was a lot of confusion with libvips and many cross-platform installation issues.

Between Docker, Ubuntu, and Mac cross-platform issues reported by the team, I wanted to drop Sharp completely as a dependency from Lad.

I tried pure JavaScript-based solutions like Jimp, and even tried PhantomJS and Puppeteer solutions, however they were all too slow.

Sharp was the fastest option, and therefore I thought making a drop-in replacement that uses a powerful server would be satisfactory.

Thus Lipo was born.

Deploy Yourself

See the test folder for an example that shows how to use the middleware lipo-koa (also see lipo-express and other related packages below).

Credits

Lips by Orin zuu from the Noun Project

Contributors

NameWebsite
Nick Baughhttp://niftylettuce.com/

License

MIT © Nick Baugh

Keywords

FAQs

Package last updated on 26 Nov 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc