Skip to content

OOP ImageMagick Module for NodeJS based on node-imagemagick by Rasmus Andersson

Notifications You must be signed in to change notification settings

siosphere/siosphere-node-imagemagick

 
 

Repository files navigation

siosphere-node-imagemagick

Based on node-imagemagick

Requires imagemagick CLI tools to be installed. There are numerous ways to install them. For instance, if you're on OS X you can use Homebrew: brew install imagemagick.

Expands upon orignal by adding a much more Object Oriented design to more closely mimic existing libraries. New functions and features will be continually added.

Examples

Resize from Data URL

im = new ImageMagick();
//small red dot
im.readImageDataUrl('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', function(image){

    new_width = 10;
    new_height = 10;

    im.resizeImage(new_width, new_height, IMAGE_MAGICK_FILTER_LANCZOS, 0, function(){
        console.log(image.data_url); //return our new data_url, can also write the file out, get binary, etc
    });
});

Crop from Filepath

im.readImage('./blue-bottle-coffee.jpg', function(image){
    //can read info like image width and height if we want to
    src_width = image.width;
    src_height = image.height;

    new_width = 100;
    new_height = 10;
    
    //where to crop image from
    var x = 0;
    var y = 10;

    im.cropImage(new_width, new_height, x, y, function(){
        console.log(image.data_url);
    });
});

License (MIT)

Copyright (c) 2012 Michael Kramer http://www.siosphere.com/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

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.

node-imagemagick License (MIT)

Copyright (c) 2010-2012 Rasmus Andersson http://hunch.se/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

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.

About

OOP ImageMagick Module for NodeJS based on node-imagemagick by Rasmus Andersson

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%