私は非常に簡単な方法を使用しました。ビットマップ ベースの画像コンテキストを作成し、拡大縮小した画像を描画します。しかし、私はいつも空の画像を取得します。
- (UIImage *)resizeImage:(UIImage *)image to:(CGSize)newSize
{
UIGraphicsBeginImageContextWithOptions(newSize, NO, 1.0);
[image drawInRect:CGRectMake(0.0, 0.0, newSize.width, newSize.height)];
UIImage * scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
どこが間違っていたのかヒントはありますか?座標系を変更しようとしています。それでもうまくいきません。
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0.0, newSize.height);
CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1.0, -1.0);