Creating a new image with new dimensions like height equals to width and width equals to height
<p>i m getting problem with the rotation of image.I want to create a new image with height equals to width because rotating by 90 degrees.but new image created change dimentions but do not place data in image accurately.</p>

<p>CGImageRef imageRef = OriginalImage.CGImage;
/////////////new height equals to width of origunal image 
    size_t newHeight = CGImageGetWidth(imageRef);
    size_t newWidth = CGImageGetHeight(imageRef);
    size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);
    size_t bitsPerPixel = CGImageGetBitsPerPixel(imageRef);</p>

<pre><code>CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);
CFDataRef argbData = CFDataCreate(NULL,rotatedPixelData,originalImageDataLength);
CGDataProviderRef provider = CGDataProviderCreateWithCFData(argbData);

CGImageRef nimage = CGImageCreate(NewWidth,NewHeight,bitsPerComponent, bitsPerPixel,bytesPerRow,colorspace,bitmapInfo,provider, NULL, true, kCGRenderingIntentDefault);
</code></pre>

<p>What should i change in parameters of CGImageCreate? </p>
