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

how to release data generated by UIImageJPEGRepresentation or UIImagePNGRepresentation?

I have a problem like that : NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSData *data; NSString *file1 = [[NSBundle mainBundle] pathForResource: [NSStringstringWithFormat:@"originimg_%d.jpg",i] ofType:nil]] ; UIImage *image1 =…
trung nguyen
  • 121
  • 2
  • 8
0
votes
1 answer

Alamofire encodes image in which format?

I am using alamofire to send Image to server with multipart. multipartFormData.append(UIImageJPEGRepresentation(self.imageDet[0].image!,0.5)!, withName: "filestream", mimeType: "image/jpeg") I have the image in byte format from server side. Here is…
user9039131
0
votes
1 answer

Having problems handling UIImageJPEGRepresentation or UIImagePNGRepresentation in Node.js

TL;DR: How do you write UIImageRepresentation data into the actual file format in a Node.js server? (or any place outside of Swift at that) . . So I'm in a bit of a predicament here... I wanted to send a UIImageJPEGRepresentation (or any form of…
0
votes
1 answer

ios UIImageJPEGRepresentation() with large image crash

I am developing an iOS app with xcode 9 and iPhone SE. I get an large photo which is a 19MB JPEG picture with NSData format from iPhone album. Then I need to fix this photo orientation, so I have to convert this photo from NSData to UIImage. Then I…
jiangjiefs
  • 149
  • 11
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
1 answer

UIImageJPEGRepresentation returns nil when file at specified path is deleted in Swift?

I'm completely confused as to how UIImageJPEGRepresentation is related to a file's path in the Documents directory. Basically, when I delete a file from a file path, and then call UIImageJPEGRepresentation on a UIImage, it returns nil, but if the…
Pangu
  • 3,721
  • 11
  • 53
  • 120
0
votes
1 answer

UIImageJPEGRepresentation increases UIImage size

I've an image (captureImage) which is taken by camera and resized. I use UIImageJPEGRepresentation to compress image, after the compression, image's size is increased. Is it normal behaviour or I'm doing compression/resizing in wrong way? if let…
Rashid
  • 1,515
  • 16
  • 16
0
votes
1 answer

Send Alamofire request with parameters and also image in HTTP body

I have an Alamofire request let parameters = ["key1":value1, "key2":value2, "keyn":valueN] as [String: AnyObject] Alamofire.request(.POST, url, parameters: parameters, encoding: .JSON, headers: ["Authorization":…
Tommy K
  • 1,759
  • 3
  • 28
  • 51
0
votes
0 answers

Swift: UIImageJPEGRepresentation return nil while looping

I've been searching for this problem for a few days already. Still no answer. I'm trying to send multiple images to the server, so, I need to convert the uiimage to nsdata first. But the nsdata seem to be a nil, but the 1st image always successful…
user3057414
  • 41
  • 1
  • 9
0
votes
1 answer

Swift - Get a Circular Image in Spotlight Search (i.e. in the thumbnail)

Does anyone have any ideas as to how to go about cropping the image that appears in the spotlight search, so that 'thumbnailData' is a circular image not a square one? None of these solutions work to the desired effect: Cut a UIImage into a circle…
David West
  • 1,550
  • 1
  • 18
  • 31
0
votes
1 answer

Faster way to take snapshots ios

I have a UICollectionView. I want to generate two snapshots for each objects. Sample Code: for (int index = 0; index < 2; index++) { UIView *dummyView = [[UIView alloc] init]; dummyView.frame = some frame...., …
0
votes
1 answer

"Cannot invoke 'insert' with an argument list of type" on a compressed image

Im getting this error and don't know why 'Cannot invoke 'insert' with an argument list of type '(Character, atIndex: Int)'' This code its working: firstImageView.contentMode = .ScaleAspectFit let imageData =…
Renato Pimpão
  • 271
  • 3
  • 17
0
votes
1 answer

When using UIImageJPEGRepresentation what number retains full resolution?

Can someone please explain the scale for me (0 to 1)? Which is the best quality/least, and how does that affect file size?
user2284295
0
votes
1 answer

Can't convert NSData to NSString when using UIImageJPEGRepresentation()?

I am creating a multipart image data upload request. i am getting NSData from UIImage by UIImageJPEGRepresentation but when i try to convert the data into string i am getting nil value i have followed this link to convert NSData to NSString Convert…
Pawan Joshi
  • 1,581
  • 3
  • 20
  • 40
0
votes
1 answer

How does UIImageJPEGRepresentation work?

I have this line of code UIImageJPEGRepresentation(profileImage, 0.8) and I was wondering if it adjusts the height and width of the image or just the size by decreasing the quality?
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82