Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 15, 2011, 12:47 PM   #1
benc555
macrumors newbie
 
Join Date: Nov 2008
How to split image?

Hey,
How can I split a UIImage(in a UIImageView) in half, into 2 different images?

Thanks!
benc555 is offline   0 Reply With Quote
Old Aug 15, 2011, 01:28 PM   #2
ViviUO
macrumors 6502
 
Join Date: Jul 2009
Just wondering ... why?
ViviUO is offline   0 Reply With Quote
Old Aug 15, 2011, 02:26 PM   #3
dantastic
macrumors 6502
 
Join Date: Jan 2011
off the top of my head now but...

Code:
CGRect newImgFrame = CGRectMake(100, 100, 50, 50);
UIImage *image = [UIImage imageNamed:@"img.png"];
CGImageRef imageRef = CGImageCreateWithImageInRect(image, newImgFrame);
image = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
This will leave you with a UIImage in 'image' that is 50x50px taken from 100/100.

Last edited by dantastic; Aug 15, 2011 at 02:27 PM. Reason: typo
dantastic is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Possible to access Origional image file from texted image? (to view metadata) inck243 iPhone Tips, Help and Troubleshooting 2 Dec 8, 2013 12:47 AM
combine a background image, another image and a video in iMovie 10? MacMan988 Digital Video 0 Oct 27, 2013 05:52 AM
Is Google Image search by image not working for you guys? tzhu07 Community Discussion 0 Oct 13, 2013 07:13 PM
capture overlay image whenever image move new position or new scale karthees iPhone/iPad Programming 1 Mar 27, 2013 02:38 PM
Problem with user touches the marker on image in image targets srilatha iPhone 0 Oct 2, 2012 02:33 AM

Forum Jump

All times are GMT -5. The time now is 01:05 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC