How to use the imagemagick.convert function in imagemagick

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 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 softwerkskammer / Agora / lib / gallery / galleryrepositoryService.js View on Github external
function autoOrient(sourceImagePath, targetPath, callback) {
  if (logger.debug) {
    logger.debug('Auto-orienting `' + sourceImagePath + '\' into `' + targetPath + '\'');
  }
  magick.convert([sourceImagePath, '-auto-orient', targetPath], function (err, stdout) {
    if (err) {
      return callback(err, undefined);
    }
    if (logger.debug) {
      logger.debug('stdout:', stdout);
    }
    callback(undefined, targetPath);
  });
}
github softwerkskammer / Agora / softwerkskammer / lib / gallery / galleryService.js View on Github external
function convert(sourceImagePath, targetPath, params, callback) {
  const angle = params.angle || '0';
  const scale = params.scale || '1';
  const geometry = params.geometry || '100x100+0+0';
  magick.convert([sourceImagePath, '-rotate', angle, '-resize', parseFloat(scale * 100) + '%', '-crop', geometry, targetPath], err => callback(err, targetPath));
}
github softwerkskammer / Agora / lib / gallery / galleryrepositoryService.js View on Github external
function scale(sourceImagePath, targetPath, width, height, fn) {
  if (logger.debug) {
    logger.debug('Scaling `' + sourceImagePath + '\' to ' + width + 'x' + height + ' into `' + targetPath + '\'');
  }
  magick.convert([sourceImagePath, '-quality', '75', '-scale', width + '!x' + height + '!', targetPath], function (err, stdout) {
    if (err) {
      return fn(err, undefined);
    }
    if (logger.debug) {
      logger.debug('stdout:', stdout);
    }
    fn(undefined, targetPath);
  });
}

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