create panorama from cropped stripes by appending img series
create panorama from cropped stripes by appending img series
Hi,
how would a command line in Win look to achieve appending a series of cropped images into a final image ?
My images have sequencial numbering (image.0001.png, image.0002.png, ...) which i got from rendering an animation where the camera rotates around the y-axis. By assembling vertical strips of only a few pixels width to a whole image, i receive a panorama image.
I've seen http://www.imagemagick.org/Usage/layers/ but wasn't able to pull together the necessary syntax for my case yet (newbie), so that i can say i have 180 images that need to be cropped and appended.
Regards,
Frank
how would a command line in Win look to achieve appending a series of cropped images into a final image ?
My images have sequencial numbering (image.0001.png, image.0002.png, ...) which i got from rendering an animation where the camera rotates around the y-axis. By assembling vertical strips of only a few pixels width to a whole image, i receive a panorama image.
I've seen http://www.imagemagick.org/Usage/layers/ but wasn't able to pull together the necessary syntax for my case yet (newbie), so that i can say i have 180 images that need to be cropped and appended.
Regards,
Frank
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: create panorama from cropped stripes by appending img se
Do your images overlap? Do they offset in the vertical dimension?
If you just need to append them side by side with no offsets, then see +append
http://www.imagemagick.org/Usage/layers/#append
If they overlap or offset, then see -mosaic, but you need to know exactly how to offset them as X,Y offsets for -page arguments
http://www.imagemagick.org/Usage/layers/#mosaic
If you just need to append them side by side with no offsets, then see +append
http://www.imagemagick.org/Usage/layers/#append
If they overlap or offset, then see -mosaic, but you need to know exactly how to offset them as X,Y offsets for -page arguments
http://www.imagemagick.org/Usage/layers/#mosaic
Re: create panorama from cropped stripes by appending img se
Hi,
thank you for reply. I wanted to put the formula with the following functionality, is it possible as 1 command that loops through 180 pictures and creates the final file ? Pls help with the necessary syntax.
convert ^
-frame 1-180 <<looping image.0001.png - image.0180.png>> ^
-crop image..png ( -crop 958,x961+3+1080 'Foreground_%[filename:names].png' \) <<cropping out a stripe of x 3 pix and y 1080 pix>> ^
-append <<appending them from left to right without overlap>> ^
result_image.png <<being 180 * 3 pix = x 540 pix, and y = 1080 pix>>
can i insert commenting in my code, so i understand it later on when adjusting to other tasks ?
Frank
thank you for reply. I wanted to put the formula with the following functionality, is it possible as 1 command that loops through 180 pictures and creates the final file ? Pls help with the necessary syntax.
convert ^
-frame 1-180 <<looping image.0001.png - image.0180.png>> ^
-crop image..png ( -crop 958,x961+3+1080 'Foreground_%[filename:names].png' \) <<cropping out a stripe of x 3 pix and y 1080 pix>> ^
-append <<appending them from left to right without overlap>> ^
result_image.png <<being 180 * 3 pix = x 540 pix, and y = 1080 pix>>
can i insert commenting in my code, so i understand it later on when adjusting to other tasks ?
Frank
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: create panorama from cropped stripes by appending img se
You will have to write a script to do the looping.Frank1000 wrote:Hi,
thank you for reply. I wanted to put the formula with the following functionality, is it possible as 1 command that loops through 180 pictures and creates the final file ? Pls help with the necessary syntax.
convert ^
-frame 1-180 <<looping image.0001.png - image.0180.png>> ^
-crop image..png ( -crop 958,x961+3+1080 'Foreground_%[filename:names].png' \) <<cropping out a stripe of x 3 pix and y 1080 pix>> ^
-append <<appending them from left to right without overlap>> ^
result_image.png <<being 180 * 3 pix = x 540 pix, and y = 1080 pix>>
can i insert commenting in my code, so i understand it later on when adjusting to other tasks ?
Frank
I am not a windows user, and since scripting syntax is different, you will have to wait for a Windows user to try to help make this into a bat file for you or at least a set of commands that loops that you can cut and paste.
You cannot add a comment within a single IM convert command, but can put comments in the script between convert commands.
see
viewtopic.php?f=1&t=24624
Re: create panorama from cropped stripes by appending img se
ok thx, ya someone who can help me with the Windows syntax.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: create panorama from cropped stripes by appending img se
Doing this in a single convert will read all the images into memory. If each is 2000x1000 pixels, at 6 bytes/pixel, 180 images, you need 2 GB memory. So I would do this in stages.
1. Within a FOR loop, convert each image, cropping to 3 pixels wide.
2. Convert these 180 files, each 3 pixels wide, with "+append".
Note that "-crop" takes 4 parameters: {width}x{height}+{x_offset}+{y_offset}. So it might be "-crop 3x1080+958+0".
1. Within a FOR loop, convert each image, cropping to 3 pixels wide.
2. Convert these 180 files, each 3 pixels wide, with "+append".
Note that "-crop" takes 4 parameters: {width}x{height}+{x_offset}+{y_offset}. So it might be "-crop 3x1080+958+0".
snibgo's IM pages: im.snibgo.com
Re: create panorama from cropped stripes by appending img se
ok thx.
how is the syntax to make a FOR loop in a .bat ?
how is the syntax to make a FOR loop in a .bat ?
Re: create panorama from cropped stripes by appending img se
my images go from image.0001.png to image.0180.png.
is this going in the right direction to write it in a .bat file ?:
SET startframe=%0001
SET endframe=%0180
SET times=%180
convert ^
FOR image.%startframe%.png
-crop 3x1080+958+0
is this going in the right direction to write it in a .bat file ?:
SET startframe=%0001
SET endframe=%0180
SET times=%180
convert ^
FOR image.%startframe%.png
-crop 3x1080+958+0
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: create panorama from cropped stripes by appending img se
FOR is a Windows command, not ImageMagick. Type "help for" at the command line.
snibgo's IM pages: im.snibgo.com
Re: create panorama from cropped stripes by appending img se
that is too complicated for me, does someone know how the correct syntax would be ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: create panorama from cropped stripes by appending img se
Something like this:
Code: Select all
set startframe=1
set endframe=180
del sub_*.png
for /L %%i in (%startframe%,1,%endframe%) do (
set NUM=000%%i
set NUM=!NUM:~-4!
convert image.!NUM!.png -crop 3x1080+958+0 +repage sub_!NUM!.png
)
convert sub_*.png +append out.png
snibgo's IM pages: im.snibgo.com
Re: create panorama from cropped stripes by appending img se
ok thx
Tried it out, but giving me :
Invalid Parameter - -crop
My image name has two dots before the number and I've inserted it this way : maybe that is the reason ?
set startframe=1
set endframe=180
del sub_*.png
for /L %%i in (%startframe%,1,%endframe%) do (
set NUM=000%%i
set NUM=!NUM:~-4!
convert my_image..!NUM!.png -crop 3x1080+958+0 +repage sub_!NUM!.png
)
convert sub_*.png +append out.png
Tried it out, but giving me :
Invalid Parameter - -crop
My image name has two dots before the number and I've inserted it this way : maybe that is the reason ?
set startframe=1
set endframe=180
del sub_*.png
for /L %%i in (%startframe%,1,%endframe%) do (
set NUM=000%%i
set NUM=!NUM:~-4!
convert my_image..!NUM!.png -crop 3x1080+958+0 +repage sub_!NUM!.png
)
convert sub_*.png +append out.png
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: create panorama from cropped stripes by appending img se
That error message is from the Windows "convert" command.Invalid Parameter - -crop
Okay. First step: have you installed ImageMagic? Is it on your path?
snibgo's IM pages: im.snibgo.com
Re: create panorama from cropped stripes by appending img se
ok sure, I forgot to point to the command right. Now I get the command running but it wouldn't yet read the images "Ritter_01_02..0001.pnd ...)
I have copied the .bat into the directory where the image files sit. and calling it from there.
I have copied the .bat into the directory where the image files sit. and calling it from there.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: create panorama from cropped stripes by appending img se
Insert the following line at the start of your command file:
Code: Select all
setlocal enabledelayedexpansion
snibgo's IM pages: im.snibgo.com