Questions tagged [uiimagejpegrepresentation]

For questions related to the UIImageJPEGRepresentation method for the UIImage class on the iOS platform, a method commonly used to convert images to JPEG.

91 questions
4
votes
2 answers

iPhone How to get image back from NSData

In my iPhone App I am storing image into NSData by UIImage *image =imageView.image; NSData *myData = UIImagePNGRepresentation(image); But How to get back "image" from "NSData" and I can display it again into in to UIImageView. Please Help and…
ios
  • 6,134
  • 20
  • 71
  • 103
4
votes
3 answers

UIImageJPEGRepresentation received memory warning

I receive a memory warning when using UIImageJPEGRepresentation, is there any way to avoid this? It doesn't crash the app but I'd like to avoid it if possible. It does intermittently not run the [[UIApplication sharedApplication] openURL:url]; -…
Sam Luther
  • 1,170
  • 3
  • 18
  • 38
4
votes
3 answers

Fastest way to handle UIImagePickerController compression

What's the fastest way of getting a picture into a SQLite data store for compression, so I can return control to the user? I'm using UIImagePickerController to take pictures in my application. The problem is using the picture is quite slow, because…
3
votes
1 answer

UIImageJPEGRepresentation giving EXC_BAD_ACCESS

In my app I am using the camera and photo library to get an UIImage, this UIImage is then scaled down about 20 times its normal size I then set a NSData object based off the UIImage. _regularImage = [self resizeImage:_takenImage width:100…
Ryan Erb
  • 828
  • 1
  • 8
  • 28
3
votes
2 answers

UIGraphicsBeginImageContextWithOptions and UIImageJPEGRepresentation not working well together

So i have this code to create a UIImage: UIGraphicsBeginImageContextWithOptions(border.frame.size, YES, 0); [border.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *thumbnailImage =…
Andrew
  • 15,935
  • 28
  • 121
  • 203
3
votes
0 answers

memory leak when JPEG, not when PNG

My application aims at saving some user photos in a PDF file in order to send the file by email. To produce a small size pdf, I want to compress my images in jpeg. When I draw jpeg to the PDF context, the pdf file is indeed much smaller than when I…
3
votes
1 answer

UIImageJPEGRepresentation and UIImagePNGRepresentation both are slow

Here i am converting my image to binary data by category on UIImage which have static method.My Problem is UIImageJPEGRepresentation and UIImagePNGRepresentation are very slow upto 6 second. I need 1 sec solution.Can Anybody help me. Here i pass…
2
votes
2 answers

Inverse of NSData to UIImage conversion?

In an iPhone app I load a JPG image off a server using a standard HTTP request. The data comes back as NSData, which I can convert into a UIImage using the [UIImage imageWithData:responseData] function. My question is, can I convert the UIImage…
chris
  • 16,324
  • 9
  • 37
  • 40
2
votes
2 answers

Compressing and resizing large images for iOS

I am making an app who's main function is displaying large images in a tableview, some can be 1000 pixels wide and 1MB+ in size. I am finding that older devices (3GS) has serious trouble handling these and quickly sends out memory warnings. I…
2
votes
1 answer

CIContext JPEG/PNG output functions producing blank images

I am attempting to output a CIImage to disk, and am looking for the most efficient way possible. I found this question, which suggests using the writeJPEGRepresentation/writePNGRepresentation methods of CIContext. However, whenever I attempt to use…
Chris Vasselli
  • 13,064
  • 4
  • 46
  • 49
2
votes
0 answers

Foresee UIImageJPEGRepresentation image size before the conversion

When you select an image to email using the iPhone photo library it allows you to select the image size (low, medium, high). My question is: how it's calculating the final image size? I'm trying to do something similar, but if I actually do the…
cusquinho
  • 387
  • 1
  • 4
  • 14
2
votes
1 answer

Why image size get increased after UIImagePNGRepresentation?

I have image file in my photos app of iphone. I have taken it to my macbook, via airdrop and checked size of the image = 1.9 MB I saved the same image to Files app of iphone and checked the image size there = 1.9 MB I have taken same image into my…
2
votes
0 answers

How to effectively compress photo to upload on iOS like Instagram?

The original size of this photo is about 1.2M (2248 * 3264), took by iPhone5S. I tried using the UIImageJPEGRepresentation and image.drawInRect method to resize (640 * 853) and compress the photo for upload. UIImageJPEGRepresentation 0.5 -…
Angolao
  • 986
  • 1
  • 15
  • 27
2
votes
3 answers

How to display the UIImageJPEGRepresentation image in iphone sdk

I want to use UIImageJPEGRepresentation to add the image in iphone, in below code i am missing some thing I don't know how to add NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:gameObj.gameThumbnails]]; UIImage *myImage=[UIImage…
Madan Mohan
  • 8,764
  • 17
  • 62
  • 96
2
votes
0 answers

Memory never goes down when I use the UIImageJPEGRepresentation in iOS

Im building an framework that returning a string image in B64 this is my line code I'm using UIImageJPEGRepresentation to reduce the image and then make it B64 imageb64Min = UIImageJPEGRepresentation(image!,…