08-13-2020, 04:08 AM
(08-12-2020, 06:24 PM)rich2005 Wrote: Not Gimp using ImageMagick
Quote:I need to take different segmented crops of an image. Say my image is 100 tall by 2000 wide (100x2000 pixels)quick-n-dirty bash script with fixed values, change as appropriate. wide.png is the 2000x100 image.
How do I automatically crop an image 100x750 starting x=0 and crop every 10 pixels and save each image to file?
Code:
#!/bin/bash
for i in $(seq 0 10 90)
do
convert wide.png -crop 750x100+$i+0 +repage "%02d"$i.png
done
for i in $(seq 100 10 990)
do
convert wide.png -crop 750x100+$i+0 +repage "%01d"$i.png
done
for i in $(seq 1000 10 1250)
do
convert wide.png -crop 750x100+$i+0 +repage $i.png
done
Thanks? I am not sure, lol. I have not messed with bash chmod linux terminal commands in 10 yrs? And then, it was just messing. (and vi, I mean are we still using that? Luckily a little clue ":q") I came here for a little help and I think I am getting tortured lol. Maybe I will just manually rectangle select and paste each one in gimp haha, no. please have mercy.
I have been trying to figure this out, as all my barriers are stupid questions but I am getting wore out.
So I believe I have everything running correctly, I can run "magick wide.png win:" and it opens up in the image in image viewer
I am a long ways from getting the script to work, the wide.png is in working directory
When I enter this line:
$ convert wide.png -crop 750x100+$i+0 +repage "%02d"$i.png
it gives me the error:
Invalid Parameter - -crop