Noob help : fewer writes to disk
Posted: 2015-11-02T06:44:43-07:00
In a perl script I need to take 2 images crop them. position them on a canvas and then overlay a third image.
i have accomplished this with 5 system calls and a 6th one to clean up the files.
i would like to do this in as few steps as possible with only one write to disk. something like
but that is producing many errors. what is the proper syntax for combining multiple commands.
i have accomplished this with 5 system calls and a 6th one to clean up the files.
Code: Select all
### Crop Bottom
system("/usr/local/bin/convert path/to/bot.png'[1920x1080]' -crop 1920x1017+0+0 path/to/b.png");
### Crop Top
system("/usr/local/bin/convert path/to/top.png'[1920x1080]' -crop 1920x690+0+0 path/to/t.png");
###Position Bottom of Image
system("/usr/local/bin/composite -gravity SouthWest path/to/b.png path/to/ovrlay.png path/to/x.png");
###Position Top of Image
system("/usr/local/bin/composite -gravity NorthWest path/to/t.png path/to/x.png path/to/y.png");
###Overlay Frame
system("/usr/local/bin/composite -gravity NorthWest path/to/ovrlay.png path/to/y.png path/to/output.jpg");
###CleanUp Temp files
system("rm path/to/*.png");
Code: Select all
composite -gravity NorthWest path/to/ovrlay.png \(composite -gravity NorthWest \(convert path/to/top.png'[1920x1080]' -crop 1920x690+0+0\) \(composite -gravity SouthWest \(convert path/to/bot.png'[1920x1080]' -crop 1920x1017+0+0\) path/to/ovrlay.png \) \) path/to/output.jpg