I am working on a pixelate application for iPhone. Because the pictures taken with the iPhone 4 camera are too big and therefore the application is working really slow when updating the pixelated picture, I am trying to create tiles of the picture first and just update the tiles not the hole picture.
When building the tiles, it works for camera roll picture taken in landscape mode (2592 x 1936 pxl) and with low resolution pictures, but not with picture taken in portrait mode (1936 x 2592 pxl).
The code for cutting the tiles from the original image looks like this:
for (i = 0; i < NrOfTilesPerHeight; i++) {
for (j = 0; j < NrOfTilesPerWidth; j++) {
CGRect imageRect = CGRectMake(j*TILE_WIDTH, i*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT);
CGImageRef image = CGImageCreateWithImageInRect(aux.CGImage, imageRect);
UIImage *img = [UIImage imageWithCGImage:image];
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
}
}
The problem is that the image created with these tiles it is rotated to a 90 degree angle anticlockwise.
Thank you a lot, Andrei