Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How automate crops of an image
#11
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)

How do I automatically crop an image 100x750 starting x=0 and crop every 10 pixels and save each image to file?

quick-n-dirty bash script with fixed values, change as appropriate. wide.png is the 2000x100 image.

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
Reply


Messages In This Thread
How automate crops of an image - by stevem0 - 08-12-2020, 01:24 AM
RE: How automate crops of an image - by Ofnuts - 08-12-2020, 08:35 AM
RE: How automate crops of an image - by stevem0 - 08-12-2020, 02:20 PM
RE: How automate crops of an image - by Kevin - 08-12-2020, 02:47 PM
RE: How automate crops of an image - by denzjos - 08-12-2020, 02:49 PM
RE: How automate crops of an image - by stevem0 - 08-12-2020, 03:58 PM
RE: How automate crops of an image - by Ofnuts - 08-12-2020, 04:11 PM
RE: How automate crops of an image - by stevem0 - 08-12-2020, 03:23 PM
RE: How automate crops of an image - by Ofnuts - 08-12-2020, 03:46 PM
RE: How automate crops of an image - by stevem0 - 08-12-2020, 04:48 PM
RE: How automate crops of an image - by rich2005 - 08-12-2020, 06:24 PM
RE: How automate crops of an image - by stevem0 - 08-13-2020, 04:08 AM
RE: How automate crops of an image - by Ofnuts - 08-13-2020, 06:49 AM
RE: How automate crops of an image - by stevem0 - 08-13-2020, 11:51 AM
RE: How automate crops of an image - by stevem0 - 08-12-2020, 08:05 PM
RE: How automate crops of an image - by rich2005 - 08-13-2020, 07:04 AM
RE: How automate crops of an image - by rich2005 - 08-13-2020, 12:46 PM
RE: How automate crops of an image - by stevem0 - 08-13-2020, 08:58 PM

Forum Jump: