Tag: uiimage

Issue With drawViewHierarchyInRect: afterScreenUpdates while taking snapshot

I am facing problem with taking snapshot of UIView along with CAEmitterLayer. Below is the code which I am using for taking snapshot: here editingView is my UIView: UIGraphicsBeginImageContextWithOptions(editingView.bounds.size, NO, 0.0); [editingView drawViewHierarchyInRect:editingView.bounds afterScreenUpdates:YES]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); Please go through the below links for Gif Images Link For For afterScreenUpdates:NO (Gif) in this […]

Trying to crop my UIImage to a 1:1 aspect ratio (square) but it keeps enlarging the image causing it to be blurry. Why?

Given a UIImage, I’m trying to make it into a square. Just chop some of the largest dimension off to make it 1:1 in aspect ratio. UIImage *pic = [UIImage imageNamed:@”pic”]; CGFloat originalWidth = pic.size.width; CGFloat originalHeight = pic.size.height; float smallestDimension = fminf(originalWidth, originalHeight); CGRect square = CGRectMake(0, 0, smallestDimension, smallestDimension); CGImageRef imageRef = CGImageCreateWithImageInRect([pic […]

Turning a UITableView into an UIImageView

I have got a UITableView, and I want to capture the visible portion of it, and put it into a UIImage. Any way of doing this? EDIT Self-answered below

Fetching Selected Image From An Array to be displayed in another view

I’m trying to fetch the selected image from the array of images.And the selected image should be displayed in new view.. – (void)viewDidLoad{ [super viewDidLoad]; selectedTag = 0; imagesName = [[NSArray alloc]initWithObjects:@”nature1.jpg”,@”nature2.jpg”,@”nature3.jpg”,@”nature4.jpg”,@”nature5.png”,@”nature6.jpg”,nil]; images = [[NSMutableArray alloc]init]; imageScroll.delegate = self; imageScroll.scrollEnabled = YES; int scrollWidth = 768; imageScroll.contentSize = CGSizeMake(scrollWidth,605); int xOffset = 0; for(index=0; index […]

Is there way to get metadata of the image file in iOS?

Possible Duplicate: Access metadata (exif tags) of image taken by UIImagePickerController – iOS/iPhone How to get image metadata in ios I have some image file in the iOS application local folder. How can i get it’s metadata?

How to zoom into a selected area of image in iPhone?

I have an ImageView when clicked on that imageview, transparent circle should be created and again when double clicking on that circle, particular Image in that circle area should be zoomed.Any suggestion would be appreciated.

How to check pixel color of a UIView or a UIImage?

I am trying to check if an entire UIView is filled with one color. I managed to get a screenshot of the UIView using the following block of code: UIImage *image = [self imageFromView]; NSFileManager *fileManager = [NSFileManager defaultManager]; NSData *myImageData = UIImagePNGRepresentation(image); [fileManager createFileAtPath:@”/Users/{username}/Desktop/myimage.png” contents:myImageData attributes:nil]; [imageData writeToFile:@”/testImage.jpg” atomically:YES]; The method implementation for imageFromView […]

Resizing Images Objective-C

This question already has an answer here: How to resize the image programmatically in objective-c in iphone 8 answers

UIImage imageNamed not autoreleasing correctly

For some reason, the retain/release behavior in the following code has me completely baffled. selectedImage = [UIImage imageNamed:@”icon_72.png”]; [selectedImage release]; This should break but does not. Why? I thought imageNamed autoreleased itself which means the release here is redundant and should break when the autorelease occurs. Here are snippets relevant to selectedImage from the .h […]

What is the best way to load a remote image?

I’ve been researching and haven’t found any answer to this question – sendAsynchronousRequest vs. dataWithContentsOfURL. Which is more efficient? more elegant? safer? etc. – (void)loadImageForURLString:(NSString *)imageUrl { self.image = nil; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:imageUrl]]; [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse * response, NSData * data, NSError * connectionError) { […]