Skip to content

Instantly share code, notes, and snippets.

@sunil-bagde
Last active September 22, 2021 19:08
Show Gist options
  • Save sunil-bagde/c76b790b06733500230ec6504d64bc99 to your computer and use it in GitHub Desktop.
Save sunil-bagde/c76b790b06733500230ec6504d64bc99 to your computer and use it in GitHub Desktop.
Tiff merge
// https://stackoverflow.com/questions/17062219/pass-multiple-parameters-to-processbuilder-with-a-space
// https://stackoverflow.com/questions/15384879/imagemagick-using-more-than-2gb-of-memory-to-convert-pdf-files
// https://www.imagemagick.org/script/command-line-options.php#limit
// Set '-limit memory 0 -limit map 0'. If that fails, you'll need a larger instance of a Amazon server to run ImageMagick.
// https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=23090
// https://github.com/imagemagick/imagemagick/issues/327
/* convert -background '#dfe1ff' -pointsize 40 -fill blue -gravity south \
-size 600x60 caption:Text\
smallerfile_7.tif +swap -gravity center -composite 1.tif
*/
let n1= [
'0.tiff',
'1.tiff',
'2.tiff',
'5.tiff',
'6.tiff',
'7.tiff',
'8.tiff',
'9.tiff',
'10.tiff',
'11.tiff',
]
console.log("n1", n1);
let s = [
"-delay","10", "-loop", "0", ...n1, " animated1.tif"
]
//convert -delay 10 -loop 0 $(ls -1 *.tiff | sort -V) animated.tif
let ls = spawn(`/usr/local/bin/convert`, s);
ls.stdout.on("data", data => {
console.log(`stdout: ${data}`);
});
ls.stderr.on("data", data => {
console.log(`stderr: ${data}`);
});
ls.on('error', (error) => {
console.log(`error: ${error.message}`);
});
ls.on("close", code => {
console.log(`child process exited with code ${code}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment