我尝试调整图像纵横比,如以下链接调整图像大小
Resizing UIimages pulled from the Camera also ROTATES the UIimage?
https://stackoverflow.com/questions/1282830/uiimagepickercontroller-uiimage-memory-and-more
也能正常工作在模拟器上完成的。但是在我的iPhone-4上,我在图片的右侧出现黑块。 (图片的第四张是黑色的)。它只发生在图像有rightOrientation权利...到目前为止。 ImageOrientation向上不给任何问题。
不知何故,我有这样的感觉,CGBitmapContextCreate是给出了问题。我已经删除了CGImageGetBytesPerRow,因为这不起作用,因为我读过。目前我有以下代码:
if (sourceImage.imageOrientation == UIImageOrientationUp || sourceImage.imageOrientation == UIImageOrientationDown) {
bitmap = CGBitmapContextCreate(NULL, targetWidth, targetHeight, 8, 4*targetWidth, colorSpaceInfo, bitmapInfo);
} else {
bitmap = CGBitmapContextCreate(NULL, targetHeight, targetWidth, 8, 4*targetHeight, colorSpaceInfo, bitmapInfo);
}
什么可能会遇到这些问题?
谢谢,这个作品非常好。还要感谢惊人的快速回复。 – ErikS