uiimage

Resize UIImage with aspect ratio?

I'm using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:kCGBlendModePlusDarker alpha:1]; UIImage *tmpValue = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); Which is working g...

iPhone UIImage overlap render bug.

I've come across a strange render bug on iPhone OS 3.0... I have two images. One is a non-transparent PNG that is predominately black with a white gradient fading upward. The second is a transparent PNG with translucent clouds. When I overlay the two using UIImageView, the intersection of the clouds and white gradient triggers a rende...

Unable to assign images to an imageView from an Array, but can assign images to an imageView from a UIImage variable

Hi all, I have a problem with arrays and passing images between views that I would like some help on! So the background is that I have: • RootViewController (which handles my table view) • CommunicationViewController which handles the detail of the selected element from the table • SelectSlideViewController which displays an image cli...

uiimage reports invalid size

I'm pulling in a UIImage from an NSURL (as data) and I need to set the frame based on the size of the image. However, the image.size.width always comes back as 0, and image.size.height comes back as a large number (my guess is the total number of bytes in the image). Is there any way to get the proper values after an image has been dow...

iPhone SDK: using CGImageCreate with an indexedColorSpace adds map to each pixel row

I am using a color map lookup table in my indexed color space. When I use CGImageCreate to create the CGImage, then create a UIImage, I get an extra COLUMN of pixels in the first 32 bits (4 pixels) of every pixel row... which causes the image to shift right by 4 pixels. It looks like the color map is being written to the first 32 bits of...

iPhone custom drawn UITableViewCell , how to load + insert images from the web in a thread?

Hi. I've been drawing custom table cells (using the samples from apple as a base) and have now come to having to do a cell which displays an image from a URL - each cell would have a different image (based on some data it has) but all the cells are the same and so the same reuse id. What's the correct structure for doing this? Obviously...

Core data not saving images iphone app

If i do the following it saves fine: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo { box = (Box *)[NSEntityDescription insertNewObjectForEntityForName:@"Box" inManagedObjectContext:managedObjectContext]; // create an instance ...

UIImage Rotation Offset

I have the following code - (void)ComputeRotationWithRadians:(CGFloat)rad { CGFloat width = exportImage.size.width; CGFloat height = exportImage.size.height; UIGraphicsBeginImageContext(CGSizeMake(width, height)); CGContextRef ctxt = UIGraphicsGetCurrentContext(); CGContextScaleCTM(ctxt, 1.0, -1.0); CGContextTran...

Drawing onto an animated UIImageView in Cocoa touch

Probably a newbie question, but: I have a UIImageView that zooms and translates using multitouch. The built in animation feature is very handy, and works great. However, now I want to draw on top of it. The problem is that anything I draw goes beneath the UIImageView. If I switch to UIImage, and draw it myself, then the animation do...

iPhone: How to get a UIImage from a url?

How do you download an image and turn it into a UIImage? ...

Converting an UIview unto UIimage causing memory leak

Hi guys!! I'm developing an app for iPhone using a coverFlow view, when the app is building the cards it is using a UIView in order to add labels and other stuff. Then I convert the UIView into UIImage using the following code: UIGraphicsBeginImageContext(imageView.bounds.size); [imageView.layer renderInContext:UIGraphicsGetCurrentCon...

Advice on using sandbox vs. caching for UITableView async image download

Apple just released some sample code on lazy loading images in a UITableView a week ago. I checked it out and implemented it into my own UITableView (which is a drawRect one for fast scrolling), to see if there was a difference from what I was already doing. After implementing I am not sure what is best; the new code or what I already h...

ImageIO initImageJPEG instances getting allocated and never released

Hi!! Im developing an app for an iPhone and I found that the following code is causing the memory allocation to increment. -(UIImage *)createRecipeCardImage:(Process *)objectTBD atIndex:(int)indx { [objectTBD retain]; // bringing the image for the background UIImage *rCard = [UIImage imageNamed:@"card_bg.png"]; CGRect frame = CG...

iPhone UIImage - Data Persistance

Hi All, Simple question regarding data persistance between application sessions. My application allows the user to select an image from the Library using a UIImagePickerController. The selected photo is then used as the background to the application. As the UIImagePickerController delegate method actually returns an image as opposed t...

PNGs and UIImage Optimisation

Hi there, Is it better to have a PNG, say 320px x 44px and display it once, or to have a PNG that is 320px x 4px and use [UIColor colorWithPatternImage:]? I know that the iPhone handles PNGs well and decompresses them, so in terms of memory, would it be best to use the smallest possible images, and in this case, use the UIColor method ...

How to archive and unarchive images in iphone

I am coding an iphone application where images are transferred from one iphone to another using bluetooth. can anyone tell me how to archive an image and send it to another iphone Then unarchive the image back . Archiving the image directly using NSKeyedarchiver doesnt work. Can anyone post sample code ...

iPhone Application Crashes (probably from multiple views use)

Hello everyone! I am preparing an iphone application in which I am using many transition among view controllers. This means that there is one main menu view controller and after i press the necessary box, a modal view controller is being pushed. After this, I press an exit button and come again to the main menu and I can reenter. The p...

How to determine image coordinates for a large cropped image within a UIImageView?

With regards to the iPhone SDK: I have a 512 x 512 pixel .png image, and I want to display it within a 200 x 200 pixel UIImageView WITH cropping (at native resolution, without zooming, fitting, or rotation). Is there a way to determine the image's coordinates that are visible inside the UIImageView? For example, if the image in the e...

UIImage not being loaded but file is there.

Hey guys, I can't seem to load an image, but I'm sure it is at the path I specify. Here is the code that tries to load the image: - (UIImage*) CPPlistImageToUIImage: (NSString *) CPPlistImage { /*TODO: Is this a memory leak? Find out*/ UIImage * ret = [UIImage imageNamed: CPPlistImage]; if(ret == nil){ RDLogString(@"W...

CGImage/UIImage lazily loading on UI thread causes stutter

My program displays a horizontal scrolling surface tiled with UIImageViews from left to right. Code runs on the UI thread to ensure that newly-visible UIImageViews have a freshly loaded UIImage assigned to them. The loading happens on a background thread. Everything works almost fine, except there is a stutter as each image becomes ...