I have an image, and I want to divide this image to n pieces. So what I'm wondering is that how can I do this with QImage? Or is there a better(performance wise) Qt class for this task?
For example imagine I have an image consist of 1920x1080 pixels, and I want to divide it to 100 pieces which means each piece will consist of 192x108 pixels. Note that I don't want to create same piece scaled to 192x108. Each piece is a distinct piece of the main picture.
I have attached an Image to make my question clearer. This image consist of 1920x1080 pixels and each part dived with grids consists of 192x108 pixels, I want to treat each of them as QImage object without actually dividing it to 100 pieces.
Is there a way to do this with QImage? Performance is important here because I'll analyze each piece and usually there is going to be more than 1000 piece.
Thank you for your help!
EDIT: Both methods work perfectly, however alexisdm's method is bit more complex, lower-level, but faster. jmk's method is easier to use but it's slower.
Thanks for both answers.