New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

imageboss-js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imageboss-js

Typescript/Javascript API for Imageboss

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-16.67%
Maintainers
1
Weekly downloads
 
Created
Source

ImageBoss Typescript/Javascript API

This is an unofficial API for interacting with ImageBoss image manipulation via Javascript.

Installation

$> npm install --save imageboss-js

Or with Yarn:

$> yarn add imageboss-js

Usage

const { ImageBoss } = require('imageboss-js'); // es5 (node, webpack, browserify, rollup...)

import { ImageBoss } from 'imageboss-js'; // typescript or es6

After importing the library, you can start manipulating images using getURL. Let's check out an example:

ImageBoss.source = 'myimages';
const converted = ImageBoss.getURL('/image.png', {
  operation: 'cover',
  width: 500,
  height: 300,
});
const converted = ImageBoss.getURL('/image.png', {
  source: 'myimages',
  operation: 'cover',
  width: 500,
  height: 300,
});

In this case, converted will get the value "https://img.imageboss.me/myimages/cover/300x200/image.png"

You can use all the operations supported by ImageBoss, like cdn, width, height or cover. All options like format, gamma, trim or threshold are also supported. Please check out the documentation of ImageBoss in order to learn more: https://imageboss.me/docs

More examples

const path = '/image.png';
ImageBoss.source = 'myimages';

// get image url using cover + options
const converted = ImageBoss.getURL(path, {
  operation: 'cover:center',
  width: 500,
  height: 300,
});

// get image url with given width
const converted = ImageBoss.getURL(path, {
  operation: 'width',
  width: 300,
});

// get image url with given height
const converted = ImageBoss.getURL(path, {
  operation: 'height',
  height: 300,
});

// get image from a CDN, with compression,
// orientation detection and progressive scans
const converted = ImageBoss.getURL(path, {
  operation: 'cdn',
});

// using any of ImageBoss' options
const converted = ImageBoss.getURL(path, {
  operation: 'width',
  width: 700,
  options: 'threshold:125'
});

// using multiple options
const converted = ImageBoss.getURL(path, {
  operation: 'width',
  width: 700,
  options: 'blur:2,grayscale:true'
});

Dev mode

Clone this repo, and start adding your code in the index.ts file. When you are done, write the tests in the index.test.ts file. For testing, this repo works with Jest.

Dev Features

  • Testing with Jest
  • Linting with TSLint
  • Works with Typescript
  • Coverage, thanks to Jest
  • Uses deterministic module resolving, with Yarn

Credits

Developed by Juan Camilo Guarín Peñaranda, Otherwise SAS, Colombia 2018

License

MIT.

Support us on Patreon

patreon

FAQs

Package last updated on 28 Apr 2020

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