Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. def split_images
  2. #'image' is a ImageMagick Object
  3. width = image.cols/number_cols
  4. height = image.rows/nubmer_rows
  5. images = []
  6. 0.upto(number_rows-1) do |x|
  7. 0.upto(number_cols-1) do |y|
  8. images << image.crop( Magick::NorthWestGravity, x*width, y*height, width, height, true)
  9. end
  10. end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement