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
3
votes
2 answers

UIImagePNGRepresentation and masked images

I created a masked image using a function form an iphone blog: UIImage *imgToSave = [self maskImage:[UIImage imageNamed:@"pic.jpg"] withMask:[UIImage imageNamed:@"sd-face-mask.png"]]; Looks good in a UIImageView UIImageView *imgView =…
Alex L
  • 8,419
  • 6
  • 43
  • 51
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
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

Sending a PNG image with BLE in Swift

I've been stuck with this problem for the past 2 hours and I'm about to give up. I've Googled a lot and just can't find something that works. I am using the newest version of XCode. I want to send a PNG image through Bluetooth Low Energy, the…
2
votes
2 answers

UIImagePNGRepresentation() returning different bytes

I have some images with transparency that I am loading from the file system into UIImageView views. For my purpose I need to compare the image in the UIImageView with the file on the filesystem. So I do something like the following: NSString…
Matthew Leffler
  • 1,386
  • 1
  • 19
  • 36
2
votes
0 answers

UIImagePNGRepresentation returns inappropriately large data

We have an UIImage of size 1280*854 and we are trying to save it in png format. NSData *pngData = UIImagePNGRepresentation(img); The problem is that the size of pngData is 9551944 which is inappropriately large for the input image size. Even…
mesibo
  • 3,970
  • 6
  • 25
  • 43
2
votes
0 answers

why UIImagePNGRepresentation() return nil? when I try to store a new image

I am generating an UIImage of a QR Code, and I want to store it. But when UIImagePNGRepresentation converts the UIImage to Data it always returns nil. please help me! public func generaImagenQR(texto:String)->UIImage?{ let data =…
miguel
  • 31
  • 2
2
votes
2 answers

Convert UIImage to base64 string in swift

I'm trying to convert a UIImage to a base64 string with the goal of uploading it to a back-end server. However, the conversion code I found in this article (which should be Apple's own implementation) generates an invalid string: Convert between…
bzatrok
  • 35
  • 1
  • 1
  • 5
2
votes
1 answer

What is the equivalent of iOS's UIImagePNGRepresentation() for OS X?

I'm trying to upload an Image File to Parse.com from OS X using Swift. Searching the Parse.com documentation (for OS X) I found the following code: let imageData = UIImagePNGRepresentation(image) let imageFile = PFFile(name:"image.png",…
2
votes
1 answer

Encoded string is not working in swift

In my swift App, I need to convert Image as String, then I need to send to Server , i.e POST. Then, if I need to GET, I dont want to decode that. Response having Image file name and path. ONline Converter: If I convert the sample image through…
McDonal_11
  • 3,935
  • 6
  • 24
  • 55
2
votes
1 answer

iOS UIImagePNGRepresentation base64 encode not giving expected output

The code static func encodeImage(image: UIImage) -> String{ var imageData = UIImagePNGRepresentation(image) let base64 = imageData.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.allZeros) return base64 } Does not return the…
Hamzah Malik
  • 2,540
  • 3
  • 28
  • 46
2
votes
2 answers

OSX UIGraphicsBeginImageContext

I have an iOS app that I am now creating for Mac OSX. I have the code below that converts the image to a size of 1024 and works out the width based on the aspect ratio of the image. This works on iOS but obviously does not on OSX. I am not sure how…
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82
2
votes
1 answer

UIImagePNGRepresentation(UIImage) throwing libpng error : No IDATs written into file

I am creating an application in which i save the thumbnails from the browser. Everything is working fine till i tend to move the directory containing this file into the other directory. It give this error: ImageIO: CGImageRead_mapData 'open' failed…
1
vote
1 answer

App Crash When I use CGImageSourceCreateThumbnailAtIndex in Swift

I just use CGImageSourceCreateThumbnailAtIndex to scale down UIImage size . I get crash Message : "IIONumber -- 'num' is not a CFNumberRef" . I could not find what is it? Thanks func scaleDownImage()->void{ var nextImage = UIImage() …
Anna
  • 181
  • 3
  • 8
1
vote
2 answers

Apple's Image loading/save code appears to be slightly modifying my images

I'm writing some tests to detect changes to the lossless image formats (starting with PNG) and finding that on Linux and Windows the image loading mechanisms work as expected - but on iOS (haven't tried on macOS) the image data is always being very…
WTH
  • 97
  • 1
  • 7