Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-retina-resizer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-retina-resizer

resize images

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by900%
Maintainers
1
Weekly downloads
 
Created
Source

本插件用于在 Gulp 中转换图片大小,可从3倍图转换到2倍或1倍,也可从2倍转到1倍。

依赖软件

本插件依赖 gm,故也须安装本地软件 GraphicsMagick 或 ImageMagick。

##使用方法 ##

'use strict';

let gulp = require('gulp');
let resizer = require('gulp-retina-resizer');

gulp.task('default', function() {
	gulp.src('slice/*.png')
		.pipe(resizer({
			base: 3,
			to: [1, 2],
			copy: true,
			im: true
		}))
		.pipe(gulp.dest('dest'))
});

参数说明

如上例子,resizer 接受一个对象作为参数(可选),默认为

{
	base: 2,
	to: 1,
	copy: false,
	im: false
}
  1. base:数字,是原始图的倍数比
  2. to:数字或数组,生成图的倍数比
  3. copy: 布尔值,是否添加按原始图的倍数比生成的图
  4. im:布尔值,为 true 时使用 ImageMagick 处理图片,否则使用 GraphicsMagick

生成的图片的尺寸将保证可以被生成图的倍数比整除。例如:大小为60x61的3倍图转2倍图时,得到的2倍图大小为40x42,如果 copytrue,还将得到60x63的3倍图。

可从3倍图转换到2倍或1倍,亦可从2倍转到1倍。即只能由高到低,不能由低到高。

Keywords

FAQs

Package last updated on 20 Jul 2016

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