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

simple-image-cdn

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-image-cdn

Simple and free image CDN

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Simple Image CDN

Simple and free image CDN

Install

yarn add simple-image-cdn

npm i simple-image-cdn

Usage

import getImageUrl from 'simple-image-cdn';

Example

const url = 'https://cdn.pixabay.com/photo/2016/03/27/18/54/technology-1283624_960_720.jpg';
const src = getImageUrl(url, {w: '100', h: '100', fit: 'cover' });

console.log(src)

//expect url:
//https://images.weserv.nl/?url=https%3A%2F%2Fcdn.pixabay.com%2Fphoto%2F2016%2F03%2F27%2F18%2F54%2Ftechnology-1283624_960_720.jpg&w=100&h=100&fit=cover


Options

Nameparamoptionsdescriptionexample
WidthwNumber (pixels)Sets the width of the image, in pixels.{w : 1080}
HeighthNumber (pixels)Sets the height of the image, in pixels.{h: 1080}
Fitfitcover, fill, contain, inside, outside, weSet height of the image{fit: 'cover'}
Device pixel ratiodprValues between 1 and 8The device pixel ratio is used to easily convert between CSS pixels and device pixels.{dpr: 2}
Smart cropa >**entropy:** focus on the region with the highest. >**attention:** focus on the region with the highest luminance frequency, color saturation and presence of skin tones. An experimental strategy-based approach to crop the image by removing boring parts. This only works with {fit : cover}{fit : cover, a : attention}
BlurblurUse values between 0 and 100.Adds a blur effect to the image.{blur: 5}
ContrastconUse values between -100 and +100, where 0 represents no change.Adjusts the image contrast.{blur: 5}
GammagamUse values between 1 and 3. The default value is 2.2.Adjusts the image gamma.{gam: 3}
Brightnessmod > '>1' will increase brightness > '< 1' will decrease the brightness. Adjusts the brightness of the image. {mod: 2}
OutputoutputAccepts jpg, png, gif, tiff, webp or json.Encodes the image to a specific format.{output: 'jpg'}
QualityqValues between 0 and 100. Defaults to 85.Defines the quality of the image. his only works when the output image is jpg, tiff or webp.{q: 90}
Compression level lUse a value between 0 and 9.The default value is 6. This only works when the output image is png{l: 4}
FilenamefilenameStringThe filename must only contain alphanumeric characters.{filename: "foto"}

You can get the full documentation here: https://images.weserv.nl/docs/

Limitation

You can only process 700 images per hour.

Special Thanks

We use Images.weserv.nl, a cool and free service. Checkout here: https://images.weserv.nl/

Keywords

FAQs

Package last updated on 02 Sep 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