Caijing_iPadAppDelegate *applicationDelegate = (Caijing_iPadAppDelegate *) [UIApplication sharedApplication].delegate;
Page *page = [article.pages objectAtIndex:0];
NSString *pageFile = page.landscapePage;
NSString *imagePath = [[applicationDelegate.articleDataManager.userIssue issuePath]stringByAppendingString:pageFile];
UIImage *image = [UIImage imageWithContentsOfFile:imagePath];
CGSize size = CGSizeMake(600, 600);
CGImageRef temp = CGImageCreateWithImageInRect(image.CGImage, CGRectMake(0, 0, 500, 500));
image = [UIImage imageWithCGImage:temp];
// UIGraphicsBeginImageContext(size);
// [image drawInRect:CGRectMake(0, 0, 500, 500)];
// UIImage *changedImage = UIGraphicsGetImageFromCurrentImageContext();
// UIGraphicsEndPDFContext();
NSData *data = UIImageJPEGRepresentation(image, 1.0);
//NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *path = [NSHomeDirectory() stringByAppendingString:@"/tmp/1.jpg"];
[data writeToFile:path atomically:NO];
本文详细介绍了如何通过Caijing_iPadAppDelegate优化图片处理流程,包括加载图片、调整尺寸、旋转图片并保存为JPEG格式。重点在于实现高效的图片处理和资源管理。
2488

被折叠的 条评论
为什么被折叠?



