about 11 years ago
The below mentioned code uses CIImage library's CICrop filter to crop the desired area from UIImage. The follwing code deoesn't deals with snapshot as CGContextRef rather crops the original image along with maintaining its quality and aspect ratio.
CGImageRef imageRef = [[UIImage imageNamed@"your_image"] CGImage]; CIImage *image = [CIImage imageWithCGImage:imageRef]; CIFilter *scaleFilter = [CIFilter filterWithName:@"CILanczosScaleTransform"]; int originalHeight=[image extent].size.height; int originalWidth=[image extent].size.width; float yScale=screenHeight / (float)originalHeight; float xScale=screenWidth / (float)originalWidth; float scale=fminf(yScale, xScale); [scaleFilter setValue:[NSNumber numberWithFloat:scale] forKey:@"inputScale"]; [scaleFilter setValue:[NSNumber numberWithFloat:1.0] forKey:@"inputAspectRatio"]; [scaleFilter setValue: image forKey:@"inputImage"]; UIImage *outputImage = [scaleFilter valueForKey:@"outputImage"];
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)