# grunt-jpg-sprites

> Grunt task for converting a set of images (JPG, PNG and more) into a spritesheet using ImageMagick.

Latest version **0.3.6** (published 2014-06-17) · 0 weekly downloads

## Install

```sh
npm install grunt-jpg-sprites
pnpm add grunt-jpg-sprites
yarn add grunt-jpg-sprites
bun add grunt-jpg-sprites
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6 |
| Published | 2014-06-17 |
| First published | 2014-06-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 0.10.26 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lukasz Lipinski |
| Maintainers | uzza |
| Keywords | jpg, png, sprite, sprites, imagemagick, resize, scale |

## Links

- npm: https://www.npmjs.com/package/grunt-jpg-sprites
- Repository: https://github.com/lukaszlipinski/grunt-jpg-sprites
- Issues: https://github.com/lukaszlipinski/grunt-jpg-sprites/issues
- npm.io page: https://npm.io/package/grunt-jpg-sprites

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.3.6 (latest) — 2014-06-17
- 0.3.5 — 2014-06-15
- 0.3.4 — 2014-06-15
- 0.3.3 — 2014-06-15
- 0.3.2 — 2014-06-15
- 0.3.1 — 2014-06-15
- 0.3.0 — 2014-06-15
- 0.2.5 — 2014-06-15
- 0.2.4 — 2014-06-15
- 0.2.3 — 2014-06-15
- 0.2.2 — 2014-06-14
- 0.2.1 — 2014-06-14
- 0.2.0 — 2014-06-14
- 0.1.1 — 2014-06-13
- 0.1.0 — 2014-06-13

## README

# grunt-jpg-sprites

> Grunt task for converting a set of images into a sprite sheets. Supports any type of images which is supported by ImageMagick (JPG, PNG and more).

## Getting Started
This plugin requires Grunt `0.4.5`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-jpg-sprites --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-jpg-sprites');
```

## The "jpg_sprites" task

### Overview
In your project's Gruntfile, add a section named `jpg_sprites` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
  jpg_sprites: {
    options: {
      orientation : 'horizontal',
      sizes : ['100x100', '50x50', '40x40']
    },
    files: {
      'images/output2.jpg' : ['images/*.jpg'],
      'images/output2.png' : ['images/*.png']
    },
    compression : {
	  type : "JPEG",
      quality : 100
    }
  },
});
```

### Options

#### options.orientation
Type: `String`
Default value: `'horizontal'`
Possible values: `'horizontal'`, `'vertical'`

Determines how images will be arranged in image sprite.

#### [options.sizes]
Type: `Array`
Default value: `[]`


#### [options.compression]
Type: `Object`
Default value: `{type : "None", quality : 100}`

Determines whether image should be compressed or not. Quality is from range 0 to 100. Possible compression types are:
'B44', 'B44A', 'BZip', 'DXT1', 'DXT3', 'DXT5', 'Fax', 'Group4', 'JBIG1',
'JBIG2', 'JPEG', 'JPEG2000', 'Lossless', 'LosslessJPEG', 'LZMA', 'LZW',
'None', 'Piz', 'Pxr24', 'RLE', 'Zip', 'RunlengthEncoded', 'ZipS'

## Usage Examples

### When you just want to create a sprite from random-size images:

```js
grunt.initConfig({
  jpg_sprites: {
    options: {
      orientation : 'horizontal'
    },
    files: {
      'images/output2.jpg' : ['images/*.jpg']
    }
  },
});
```

### When you have set of images of the same size and you want to create multiple resized sprites:

```js
grunt.initConfig({
  jpg_sprites: {
    options: {
      orientation : 'horizontal',
      sizes : ['100x100', '50x50', '40x40']
    },
    files: {
      'images/output2.jpg' : ['images/*.jpg']
    }
  },
});
```

### Example with enabled compression

```js
grunt.initConfig({
  jpg_sprites: {
    options: {
      orientation : 'horizontal',
      sizes : ['100x100', '50x50', '40x40'],
      compression : {
        type : "JPEG",
      	quality : 100
      }
    },
    files: {
      'images/output2.jpg' : ['images/*.jpg']
    }
  },
});
```

## Dependencies
- ImageMagick 6.8.9-1 (tested)

## Release History
- Version 0.3.x - Support for compression
- Version 0.2.x - Sprite creation and resizing

---
_Source: https://npm.io/package/grunt-jpg-sprites · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
