Questions tagged [uiimagepngrepresentation]

Use this tag for questions related to UIImagePNGRepresentation.

Use this tag for questions related to UIImagePNGRepresentation. For e.g. There is something wrong while you process UIImagePNGRepresentation with your Image.

69 questions
55
votes
6 answers

UIImagePNGRepresentation issues? / Images rotated by 90 degrees

I want to load images from UIImagePickerController, then save the selected photo to my app's document directory. UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; NSData *data1 = UIImagePNGRepresentation(image); NSString…
disorderdev
  • 1,458
  • 1
  • 14
  • 28
23
votes
3 answers

Convert UIImage to NSData without using UIImagePngrepresentation or UIImageJpegRepresentation

I Need to convert UIImage to NSData but without using UIImagePngRepresentation or UIImageJpegRepresentation, for images from photolib i can use assetlib method as mentioned here Using ALAssetsLibrary and ALAsset take out Image as NSData , but for…
H Bastan
  • 259
  • 1
  • 2
  • 11
13
votes
1 answer

Any way to encode a PNG faster than UIImagePNGRepresentation?

I'm generating a bunch of tiles for CATiledLayer. It takes about 11 seconds to generate 120 tiles at 256 x 256 with 4 levels of detail on an iPhone 4S. The image itself fits within 2048 x 2048. My bottleneck is UIImagePNGRepresentation. It takes…
Luke
  • 13,678
  • 7
  • 45
  • 79
12
votes
2 answers

How to compress image size using UIImagePNGRepresentation - iOS?

I'm using UIImagePNGRepresentation to save an image. The result image is of size 30+ KB and this is BIG in my case. I tried using UIImageJPEGRepresentation and it allows to compress image, so image saves in < 5KB size, which is great, but saving it…
10
votes
3 answers

UIImagePNGRepresentation(UIImage()) returns nil

Why does UIImagePNGRepresentation(UIImage()) returns nil? I'm trying to create a UIImage() in my test code just to assert that it was correctly passed around. My comparison method for two UIImage's uses the UIImagePNGRepresentation(), but for some…
Rodrigo Ruiz
  • 4,248
  • 6
  • 43
  • 75
10
votes
5 answers

png_error inside UIImagePNGRepresentation only on iOS 5.1+

We are experiencing a strange crash where UIImagePNGRepresentation() is sometimes causing png_error calls. We have been unable to reproduce this error on any of our devices in house. Here is an example of the stack trace from one of our HockeyApp…
Senior
  • 2,259
  • 1
  • 20
  • 31
8
votes
1 answer

PNG/JPEG representation from CIImage always returns nil

I'm currently making a photo editing app. When a photo is selected by the user, it is automatically converted into black and white using this code: func blackWhiteImage(image: UIImage) -> Data { print("Starting black & white") let orgImg =…
8
votes
1 answer

UIImagePickerControllerOriginalImage vs original asset data

In the app that I am developing, I am using an image that a user chooses from their photo albums. I need to upload a hi-res version of that photo to my server. I'm using imagePickerController and I've determined that I have 2 options use…
jessieloo
  • 1,759
  • 17
  • 24
5
votes
2 answers

Image size is resized when convert it from data in swift 3

I want to save an image in database. Therefore I convert it to Data. However during these steps the width and height of the image will change. It is increased in size. // Original Image Size print("Original Image Size : \(capturedImage.size)") //…
Muthu Sabarinathan
  • 1,198
  • 2
  • 21
  • 49
5
votes
1 answer

XCODE 5 iOS7 how to convert UIImage (PNG) to NSData without losing the transparent background

i have a method that receives a UIImage I convert it to NSData and make a request to post that Data, it works on iOS 6 but when i try on iOS 7, the image lose the transparent background. this is what i have tried till now: -(void)post:(UIImage…
fiigo0
  • 53
  • 1
  • 5
5
votes
3 answers

how to know this image is jpg or png iphone

i will like to pick an images from UIImagepicker, there are PNG and JPG format in camera roll. and i need to convert it into NSData. However i need to know if this images is UIImageJPEGRepresentation or UIImagePNGRepresentation so i could convert…
Desmond
  • 5,001
  • 14
  • 56
  • 115
4
votes
1 answer

UIImagePNGRepresentation ..... writeToFile is always landscape

Each time I use the camera to take a photograph, then save it the image is always in landscape. This means the UIImageView in my Xib is the wrong way around. Its Portrait - which is what I want and expected. I can correct this by rotating the image…
truescot
  • 41
  • 1
  • 2
4
votes
1 answer

EXC_BAD_ACCESS error in UIImagePNGRepresentation when Guard Malloc enabled

I am getting EXC_BAD_ACCESS error at UIImagePNGRepresentation() when Guard Malloc enabled and when I disable I am not getting any error while converting image. I have gone through google for solution but I am not find any working solution approach.…
Theja
  • 744
  • 1
  • 7
  • 24
4
votes
2 answers

Sending and receiving imagepng output via json encode AJAX

I created a PNG image using PHP GD Library, added some text based on user input, and instead of saving it, I want to display it until user commits to changes. They will add a few words, change a font, etc. so it needs to display their changes. The…
LITguy
  • 623
  • 4
  • 13
  • 39
3
votes
3 answers

Memory issue in using UIImagePNGRepresentation

I found this module to be troublesome. I import more than 100 images from Photolibrary, save them in documents directory with a different name. As expected I had a memory issue in the unusual place. It seems UIImagePNGRepresenation is caching files.…
Dhilip
  • 498
  • 5
  • 18
1
2 3 4 5