I have an image 100x100 pixels.
I am slicing the image into four vertical slices of varying widths.
I want the first slice to be 10 pixels wide, the second slice to be 20 pixels wide, the third slice to be 30 pixels wide and the fourth slice to be 40 pixels wide.
The height is a constant 100% of the image.
I know the following code will do the job...
Code: Select all
convert in.png -crop 10x0+0+0 slice1.png
convert in.png -crop 20x0+10+0 slice2.png
convert in.png -crop 30x0+30+0 slice3.png
convert in.png -crop 40x0+60+0 slice4.png
How can I ask IM to just slice from column 0 to column 10, from columns 10 to 30, from columns 30 to 60, and from column 60 to 100.
---
My reason for asking is that I want to slice a 1000x1000 image into sixty vertical slices of varying widths. I have the sixty x coordinates (0, 15, 37, 58, 84 ... 852, 912, 945, 982) but working out offsets and writing out sixty crop commands seems like the wrong way to go.
I'm guessing an array of x coordinates and some sort of loop is the correct way to go but I can't even work out what command to use as they all seem to need an offset. (Or do I also use the loop to work out the offset?)
Still a programming and IM noob so all assistance appreciated
Kubuntu 15.10
IM 6.8.9-9
Regards
Miguel