ofxIphoneScreengrab orientation setting?

I’m working on a camera app and ofxIphoneScreengrab is working fine, but every picture it takes and saves into the photo album is always portrait. I’m wondering how I could change the method to make this landscape or at least make a bool to have it be landscape or portrait. I’ve gotten close by swapping width/height, but I’m missing a lot of understanding about how the method is working. Here is the bit from the core…does anyone know how I could swap things around to have the photo app recognize pictures as landscape?

  
void ofxiPhoneScreenGrab(id delegate) {  
	CGRect rect = [[UIScreen mainScreen] bounds];  
  
        //JRW - Retina Fix for PhotoGrab    
        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES){    
              
            float f_scale = [[UIScreen mainScreen] scale];    
              
            rect.size.width *= f_scale;    
            rect.size.height *= f_scale;    
        }    
          
	int width = rect.size.width;  
	int height =  rect.size.height;  
	  
	NSInteger myDataLength = width * height * 4;  
	GLubyte *buffer = (GLubyte *) malloc(myDataLength);  
	GLubyte *bufferFlipped = (GLubyte *) malloc(myDataLength);  
	glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);  
	for(int y = 0; y <height; y++) {  
		for(int x = 0; x <width * 4; x++) {  
			bufferFlipped[int((height - 1 - y) * width * 4 + x)] = buffer[int(y * 4 * width + x)];  
		}  
	}  
	free(buffer);	// free original buffer  
	  
	CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bufferFlipped, myDataLength, releaseData);  
	CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();  
	CGImageRef imageRef = CGImageCreate(width, height, 8, 32, 4 * width, colorSpaceRef, kCGBitmapByteOrderDefault, provider, NULL, NO, kCGRenderingIntentDefault);		  
	  
	CGColorSpaceRelease(colorSpaceRef);  
	CGDataProviderRelease(provider);  
	  
	UIImage *image = [[UIImage alloc] initWithCGImage:imageRef];  
	CGImageRelease(imageRef);  
	  
	SaveDelegate *saveDelegate = [SaveDelegate new];  
	saveDelegate.delegate = delegate;  
	UIImageWriteToSavedPhotosAlbum(image, saveDelegate, @selector(image:didFinishSavingWithError:contextInfo:), nil);  
}