How to use imagemagick - 10 common examples

To help you get started, we’ve selected a few imagemagick examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Hanul / UPPERCASE / UPPERCASE.IO-UTIL / NODE.js View on Github external
// callback.
			callback,

			// error handler.
			errorHandler;

			if (callbackOrHandlers !== undefined) {
				if (CHECK_IS_DATA(callbackOrHandlers) !== true) {
					callback = callbackOrHandlers;
				} else {
					callback = callbackOrHandlers.success;
					errorHandler = callbackOrHandlers.error;
				}
			}

			imagemagick.convert(params, function(error) {

				var
				// error msg
				errorMsg;

				if (error !== TO_DELETE) {

					errorMsg = error.toString();

					if (errorHandler !== undefined) {
						errorHandler(errorMsg);
					} else {
						console.log(CONSOLE_RED('[UPPERCASE.IO-IMAGEMAGICK_CONVERT] ERROR: ' + errorMsg));
					}

				} else {
github Hanul / nsp-sample-restful / import / UPPERCASE-UTIL / NODE.js View on Github external
// callback.
			callback,

			// error handler.
			errorHandler;

			if (callbackOrHandlers !== undefined) {
				if (CHECK_IS_DATA(callbackOrHandlers) !== true) {
					callback = callbackOrHandlers;
				} else {
					callback = callbackOrHandlers.success;
					errorHandler = callbackOrHandlers.error;
				}
			}

			imagemagick.convert(params, function(error) {

				var
				// error msg
				errorMsg;

				if (error !== TO_DELETE) {

					errorMsg = error.toString();

					if (errorHandler !== undefined) {
						errorHandler(errorMsg);
					} else {
						console.log(CONSOLE_RED('[UPPERCASE-IMAGEMAGICK_CONVERT] ERROR: ' + errorMsg));
					}

				} else {
github TooTallNate / nTunes / handlers.js View on Github external
format = "jpg";
        } else if (/PNG/i.test(format)) {
          format = "png";
        } else {
          throw new Error("Unrecognized iTunes Artwork format: \"" + format +'"')
        }
        
        var args = req.parsedUrl.query;
        if (args) {
          if (args.size) args.width = args.height = args.size;
          this.parallel()(null, args.format || format);
          args.srcData = rawData.toString('binary');
          args.srcFormat = format;
          args.format = args.format || format;
          delete args.dstPath;
          im.resize(args, this.parallel());
        } else {
          // No query params given, just send the original image data.
          this.parallel()(null, format);
          this.parallel()(null, rawData);
        }
      },
      function(err, format, rawData) {
github Hanul / UPPERCASE / UPPERCASE-UTIL / NODE.js View on Github external
// callback.
			callback,

			// error handler.
			errorHandler;

			if (callbackOrHandlers !== undefined) {
				if (CHECK_IS_DATA(callbackOrHandlers) !== true) {
					callback = callbackOrHandlers;
				} else {
					callback = callbackOrHandlers.success;
					errorHandler = callbackOrHandlers.error;
				}
			}

			imagemagick.convert(params, function(error) {

				var
				// error msg
				errorMsg;

				if (error !== TO_DELETE) {

					errorMsg = error.toString();

					if (errorHandler !== undefined) {
						errorHandler(errorMsg);
					} else {
						SHOW_ERROR('[UPPERCASE-IMAGEMAGICK_CONVERT] ERROR: ' + errorMsg);
					}

				} else {
github Hanul / UPPERCASE / SRC / UTIL / NODE / IMAGEMAGICK / IMAGEMAGICK_CONVERT.js View on Github external
// callback.
			callback,

			// error handler.
			errorHandler;

			if (callbackOrHandlers !== undefined) {
				if (CHECK_IS_DATA(callbackOrHandlers) !== true) {
					callback = callbackOrHandlers;
				} else {
					callback = callbackOrHandlers.success;
					errorHandler = callbackOrHandlers.error;
				}
			}

			imagemagick.convert(params, function(error) {

				var
				// error msg
				errorMsg;

				if (error !== TO_DELETE) {

					errorMsg = error.toString();

					if (errorHandler !== undefined) {
						errorHandler(errorMsg);
					} else {
						SHOW_ERROR('[UPPERCASE-IMAGEMAGICK_CONVERT] ERROR: ' + errorMsg);
					}

				} else {
github heapsource / mongoose-attachments / lib / attachments.js View on Github external
tasks.push(function(cb) {

                  // invoke 'convert'
                  im.convert(convertArgs, function(err, stdout, stderr) {
                    if(err) return cb(err);

                    // run identify in the styled image
                    im.identify(styleFilePath, function(err, atts) {
                      if(err) return cb(err);
                      finishConversion(styleFilePath, atts, cb);
                    });
                  });

                }); // tasks.push
              } else {
github WaleedAshraf / serverless-app / handler.js View on Github external
return new Promise(function (res, rej) {
    im.convert(params, (err) => {
      if (err) {
        console.log(`Error${err}`);
        rej(err);
      } else {
        res('operation completed successfully');
      }
    });
  });
}
github luthraG / image-watermark / watermark.js View on Github external
im.identify(source, function (err, imageData) {
	  if (err)
	  	throw new Error('Image-Watermark::embedWatermark : Unable to process image file : ' + err);

	  var retObj = _parseOptions(imageData, source, options);

	  im.convert(retObj.args, function(err, stdout) {
	  	if (err)
	    	console.log('Image-Watermark::embedWatermark : Error in applying watermark : ' + err);
	    else
	      	console.log('Image-Watermark::embedWatermark : Successfully applied watermark. Please check it at :\n ' + retObj.outputPath);
	  });
	});
}
github blueimp / jQuery-File-Upload / server / node / server.js View on Github external
Object.keys(options.imageVersions).forEach(function (version) {
                    counter += 1;
                    var opts = options.imageVersions[version];
                    imageMagick.resize({
                        width: opts.width,
                        height: opts.height,
                        srcPath: options.uploadDir + '/' + fileInfo.name,
                        dstPath: options.uploadDir + '/' + version + '/' +
                            fileInfo.name
                    }, finish);
                });
            }
github tus / tus-jquery-client / jquery-file-upload / server / node / server.js View on Github external
Object.keys(options.imageVersions).forEach(function (version) {
                    counter += 1;
                    var opts = options.imageVersions[version];
                    imageMagick.resize({
                        width: opts.width,
                        height: opts.height,
                        srcPath: options.uploadDir + '/' + fileInfo.name,
                        dstPath: options.uploadDir + '/' + version + '/' +
                            fileInfo.name
                    }, finish);
                });
            }

imagemagick

A wrapper around the imagemagick cli

Unknown
Latest version published 12 years ago

Package Health Score

44 / 100
Full package analysis

Popular imagemagick functions