https://github.com/webcaetano/gulp-image-scramble
GulpJS module for image-scramble with seed
https://github.com/webcaetano/gulp-image-scramble
Last synced: 11 months ago
JSON representation
GulpJS module for image-scramble with seed
- Host: GitHub
- URL: https://github.com/webcaetano/gulp-image-scramble
- Owner: webcaetano
- License: mit
- Created: 2015-11-02T20:26:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-08T00:37:32.000Z (over 10 years ago)
- Last Synced: 2025-06-28T09:45:24.586Z (11 months ago)
- Language: JavaScript
- Size: 160 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gulp Image Scramble
GulpJS module for image-scramble with seed
[](https://www.npmjs.com/package/gulp-image-scramble)
[](https://travis-ci.org/webcaetano/gulp-image-scramble)
[](https://www.npmjs.com/package/gulp-image-scramble)
Scramble/Unscramble Images
Very useful for protect canvas spritesheets.
### Example
#### Scramble (Server-Side)

#### Unscramble (Client-Side)

### Usage Example
```javascript
var imgScramble = require('gulp-image-scramble');
gulp.src(mainFile)
.pipe(imgScramble({
seed:'Kappa',
sliceSize:5
}))
.pipe(gulp.dest('./dist'))
```
## Options
#### seed
- Seed to shuffle in same sequence
#### sliceSize
- size of each slice
### Installation
```
npm install gulp-image-scramble
```
## UnsrcambleImg (Client-Side)
#### Installation
```
bower install unscramble-img
```
#### Usage
```javascript
// unscrambleImg(src,sliceSize,seed)
var canvas = unscrambleImg(img,sliceSize,'Kappa');
```
#### Phaser Example
```javascript
var bmp = unscrambleImg(img,sliceSize,'Kappa',game.add.bitmapData(img.width,img.height));
var sprite = game.add.sprite(0, 0, bmp);
```