https://github.com/mradionov/gm-mirrorize
Extension for Node.js image manipulation library gm which allows to mirror images
https://github.com/mradionov/gm-mirrorize
Last synced: 2 months ago
JSON representation
Extension for Node.js image manipulation library gm which allows to mirror images
- Host: GitHub
- URL: https://github.com/mradionov/gm-mirrorize
- Owner: mradionov
- License: other
- Created: 2015-03-20T12:25:47.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-28T19:44:00.000Z (about 9 years ago)
- Last Synced: 2025-02-07T19:16:01.380Z (3 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gm-mirrorize
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gm-mirrorize
===
Extension for [Node.js][ref_nodejs] image manipulation library [gm][ref_gm] which allows to mirror images (create reflections of the images).Based on original script for [ImageMagick][ref_ImageMagick] by Fred Weinhaus:
http://www.fmwconcepts.com/imagemagick/mirrorize/index.phpExtension was implemented accroding to the [guide][ref_gm_ext], method called `mirrorize` will be embedded into `gm` prototype.
### Support
Extension works only with [ImageMagick][ref_ImageMagick], it **will not work** with [GraphicsMagick][ref_GraphicsMagick], which is default for [gm][ref_gm].
If [ImageMagick][ref_ImageMagick] was not enabled, the method `mirrorize` will do nothing to the image.Supported version of [gm][ref_gm] is **>=1.3.2**.
### Description
```js
.mirrorize(direction)
```- **direction** (*optional*, defaults to `West`) - describes which part of the image will be reflected. For example `North` will result into the north half of the image to be reflected, reflection will be placed over the south part of the image (see [examples](#examples) below)
Available directions:
* `North`
* `South`
* `West` (_default_)
* `East`
* `NorthWest`
* `NorthEast`
* `SouthWest`
* `SouthEast`### Usage
```js
// use ImageMagick
var gm = require('gm').subClass({ imageMagick: true });// extend "gm" with "mirrorize" method
require('gm-mirrorize');// basic
gm('/path/to/my/img.jpg')
.mirrorize('NorthWest')
.write('/path/to/mirrorize.jpg', function (err) {
// ...
});// multiple
gm('/path/to/my/img.jpg')
.mirrorize('North')
.mirrorize('West')
.write('/path/to/mirrorize.jpg', function (err) {
// ...
});// chain
gm('/path/to/my/img.jpg')
.rezise(800, 600)
.crop(400, 200, 10, 30)
.mirrorize('South')
.flop()
.rezise(200, 200)
.write('/path/to/mirrorize.jpg', function (err) {
// ...
});```
### Examples
##### Original
##### Mirrorized



### Test
Run from the extension directory:
``` bash
npm test
```[ref_nodejs]: https://nodejs.org/
[ref_gm]: https://github.com/aheckmann/gm
[ref_gm_ext]: https://github.com/aheckmann/gm/wiki/Extending-gm
[ref_ImageMagick]: http://www.imagemagick.org/
[ref_GraphicsMagick]: http://www.graphicsmagick.org/### License
Copyright © Michael Radionov
Copyright © Fred WeinhausLicense terms are based on the original script license terms provided by Fred Weinhaus and can be found at http://www.fmwconcepts.com/imagemagick/mirrorize/index.php.
This software and associated documentation files (the "Software") is available free of charge ONLY for non-commercial use.
To use the Software in commercial (for-profit) environments or non-free applications, and also to modify, publish, distribute, sublicinse, incorporate into other software or reprogramming into another scripting languages, you must contact Fred Weinhaus for licensing arrangements ( contact information - http://www.fmwconcepts.com/imagemagick/index.php ).The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.