I'd like to create a slit-photography script

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
luigi

I'd like to create a slit-photography script

Post by luigi »

Hi All,

I need some help from the IM community.

I have a list of JPG files extrated from a video.
I'd like to get a 1 pixel slice from the middle of each file and then create an image putting every slice one after the other.
So if I have 2000 images of 1024x768 the result is a 2000x768 image as there would be 2000 slices 1 pixel wide.

I guess it can be done with convert -crop and montage but I'm not in a bright day and I don't know how.

Thanks a lot if you can help me!
Luis
luigi

Re: I'd like to create a slit-photography script

Post by luigi »

I think I had a lapse of brightness :

for %%Y in (%1) do convert.exe -crop 1x1080+960+0 %%Y "slit_%%Y"
montage -tile x1 -geometry +0+0 slit*.jpg result.jpg
del slit*.jpg


Hope you find this useful :D

(first convert the video file to invividual JPGs then run this batch as foo.bat frames*.jpg)

Please verify if I did this right or if I mangled something!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: I'd like to create a slit-photography script

Post by fmw42 »

see -chop which allows you to extract a row row or column from the middle of an image http://www.imagemagick.org/Usage/crop/#chop

The problem may be your OS's ability to list so many images at one time when you go to put all the slices together using montange.

You may be better off writing a script loop to chop the data from each image and then append it successively to some temp images so that you build up the final image one slice at a time.

see append http://www.imagemagick.org/Usage/layers/#append

you may have to start with one column of constant data as the temp file and then chop from each image, append to the temp and then at the end, crop or chop off the first non-relevant row or column that was used as the initial temp file. Alternately, put an conditional in the loop to take the first slice of column or row and use as the initial temp without appending. Then for all other rows or columns use that temp file and chop a new slice from another image and append to the previous temp.
Post Reply