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
0
votes
0 answers

How to retain UIImage orientation when converting to PNG in order to generate thumbnail

I have an app where I want to create thumbnails from existing UIImages. I used the function below to take the argument of the full size UIImage and return the 100pxl icon/thumb UIImage. It all seemed to be working great but I noticed that some of…
Daniel Patriarca
  • 361
  • 3
  • 20
0
votes
1 answer

Cannot convert value of type 'Data?' to expected argument type 'UIImage

I'm trying to get the data of an image but I'm getting this error: Cannot convert value of type 'Data?' to expected argument type 'UIImage' The code: if let image = profileImageView.image { if let imageData =…
Anvil
  • 1,745
  • 1
  • 11
  • 16
0
votes
2 answers

Data to UIImage to UIImageJPEGRepresentation equality failure

Why does this transformation fails to result in the same image data? let path = Bundle(for: type(of: self)).url(forResource: "Image", withExtension: "jpg") inputData = try! Data(contentsOf: path!) let testImage = UIImage(data:…
Zsolt
  • 3,648
  • 3
  • 32
  • 47
0
votes
1 answer

create transparent texture in swift

I just need to create a transparent texture.(pixels with alpha 0). func layerTexture()-> MTLTexture { let width = Int(self.drawableSize.width ) let height = Int(self.drawableSize.height ) let texDescriptor =…
0
votes
1 answer

Program to generate QRCode and email it as attachment not working because UIImagePNGRepresentation is giving back nil

Please find code below. I am creating a QRCode. Then I want to convert it to png and email as an attachment. The line: let imgData = UIImagePNGRepresentation(imageToEmail) keeps giving back nil and causes the code to crash. Any help? class…
0
votes
1 answer

How to get resized image with quality as original iOS?

I have reviewed and applied many reference to resize image with same quality but not able to get. I am able to get image from UIView and resize with code as mentioned below: - - (UIImage *)imageWithView:(UIView *)view { …
Asif Raza
  • 836
  • 12
  • 29
0
votes
2 answers

Why PNG image got double size after taking screenshot of UIView?

I am able to take screenshot from UIView at iPhone 6 with below code: - Here I have printed 2 logs. First gives me image size {375, 667} but after converting it to PNG format it gives me image size {750, 1334}. I know that it's converting it for…
Asif Raza
  • 836
  • 12
  • 29
0
votes
0 answers

Swift image upload to PHP sends TMP file instead of Image

I have an App where I take a picture from the camera and it has to be send to a server (PHP), the problem is, that when I upload the picture, the server only receives a tmp file instead. How can I solve this? I thank your answers in advance. My code…
0
votes
0 answers

Convert a screen capture into a UIImage UIImagePNGRepresentation

Below I convert a screen capture into a NSData UIImagePNGRepresentation. But how do I correct the below code and convert a screen capture into a UIImagePNGRepresentation but ensure it's using a UIImage format and not NSData? // Take snapshot of…
user4806509
  • 2,925
  • 5
  • 37
  • 72
0
votes
1 answer

Problems with UIImagePNGRepresentation

I'm trying to use this line of code [UIImagePNGRepresentation(image, 1.0) writeToFile:pngPath atomically:YES]; But obviously pngPath is undeclared. So I have to use stringByAppendingPathComponent. I googled examples of this, and I found…
Joethemonkey101
  • 45
  • 2
  • 11
0
votes
3 answers

Objective-c UIImagePNGRepresentation causing memory leak

I'm trying to download and save some images (converted from a base64 string to UIImage) to the device and keep getting a Memory warning. ontracFullScreenImageViewController *etrackDiagrams =…
jampez77
  • 5,012
  • 7
  • 32
  • 52
0
votes
1 answer

Unable to load/retrieve image from Core Data

I've searched the internet all day for a solution, not getting anywhere.. I am saving an image to core data which when tested using print(results) with NSFetchRequest, suggests is stored in the Core Data by showing the following in 'debug…
devim1
  • 522
  • 3
  • 13
0
votes
0 answers

Image clipping with path (scaling issue)

The app I am using for testing puposes is able to take a picture and save it as a PNG file. The next time the app is launched, it checks if a file is present and if it is, the image stored inside the file is used as the background view of the app.…
Michel
  • 10,303
  • 17
  • 82
  • 179
0
votes
2 answers

AVCaptureStillImageOutput & UIImagePNGRepresentation

I am having a hard time for something I think shouldn’t be so difficult, so I presume I must be looking at the problem from the wrong angle. In order to understand how AVCaptureStillImageOutput and the camera work I made a tiny app. This app is able…
Michel
  • 10,303
  • 17
  • 82
  • 179
0
votes
0 answers

UIImage PNG conversion failure

I have an array of UIImages I am converting to PNG with UIImagePNGRepresentation. The UIImages are loaded from PHAssets from my photos library. Most convert without a problem, except for a few that will cause it to crash with the message: fatal…
noizybrain
  • 155
  • 1
  • 15