parrots <- load.image(system.file('extdata/parrots.png',package='imager'))
subim(parrots,x < 30) #Only the first 30 columns
subim(parrots,y < 30) #Only the first 30 rows
subim(parrots,x < 30,y < 30) #First 30 columns and rows
subim(parrots, sqrt(x) > 8) #Can use arbitrary expressions
subim(parrots,x > height/2,y > width/2) #height and width are defined based on the image
subim(parrots,cc==1) #Colour axis is "cc" not "c" here because "c" is an important R function
##Not run
##subim(parrots,x+y==1)
##can't have expressions involving interactions between variables (domain might not be square)
Run the code above in your browser using DataLab