Quantcast
Channel: How do I save a UIImage to a file? - Stack Overflow
Browsing latest articles
Browse All 10 View Live
↧

Answer by Torianin for How do I save a UIImage to a file?

In Swift 4.2:// Create path.let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)if let filePath = paths.first?.appendingPathComponent("MyImageName.png") { // Save image....

View Article


Answer by Samo for How do I save a UIImage to a file?

In Swift 4:// Create path.let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)if let filePath = paths.first?.appendingPathComponent("MyImageName.png") { // Save image. do...

View Article

Answer by neoneye for How do I save a UIImage to a file?

extension UIImage { /// Save PNG in the Documents directory func save(_ name: String) { let path: String = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! let url...

View Article

Answer by NatashaTheRobot for How do I save a UIImage to a file?

In Swift 3:// Create path.let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)let filePath = "\(paths[0])/MyImageName.png"// Save...

View Article

Answer by Alex the Ukrainian for How do I save a UIImage to a file?

The above are useful, but they don't answer your question of how to save in a subdirectory or get the image from a UIImagePicker. First, you must specify that your controller implements image picker's...

View Article


Answer by Maggie for How do I save a UIImage to a file?

NSData *imageData = UIImagePNGRepresentation(image);[imageData writeToFile:path atomically:YES];where path is the name of the file you want to write it to.

View Article

Answer by lu yuan for How do I save a UIImage to a file?

First you should get the Documents directory/* create path to cache directory inside the application's Documents directory */NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,...

View Article

Answer by DrummerB for How do I save a UIImage to a file?

Of course you can create subfolders in the documents folder of your app. You use NSFileManager to do that.You use UIImagePNGRepresentation to convert your image to NSData and save that to disk.//...

View Article


Answer by Sergey Kalinichenko for How do I save a UIImage to a file?

You have to construct a representation of your image as a particular format (say, JPEG or PNG), and then call writeToFile:atomically: on the representation:UIImage *image = ...;NSString *path =...

View Article


How do I save a UIImage to a file?

If I have a UIImage from an imagePicker, how can I save it to a subfolder in the documents directory?

View Article
Browsing latest articles
Browse All 10 View Live