Convert String from JSON to UIImage - ios

I'm receiving some JSON data from a webservice, which includes an image represented as a Sting.
How can I convert this string into an image?
The JSON data is in an NSDictionary, and the Image data is the Object form the "Content"-key:
if let newBannerContentString = newBanner.objectForKey("Content") as? String {
let someImage = UIImage(contentsOfFile: newBannerContentString)
}
This returns nil to someImage.

If string is base64 encoded you could create NSData from that string and image from that data.
if let newBannerContentString = newBanner.objectForKey("Content") as? String {
let data = NSData(base64EncodedString: newBannerContentString, options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters);
let someImage = UIImage(data: data!);
}

Related

Convert Raw JSON response to image

I have a server response which is in json format and I have an image sent as a raw data in the response. I want to convert it into image and put it in the imageView that I have. The value for the image in json response is :
"storedisplayimage" : "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQy419TQ6bt9rpJqkugoopy9sQ3R2vzzOTjkMqK3mb
store what JSON throws you so you can displayed later while convert
override func viewDidLoad() {
super.viewDidLoad()
let userImage = UserDefaults.standard.string(forKey: "PictureFromJson")
let imageBase64 = ConduPerfilViewController.convertBase64ToImage(imageString: userImage!)
viewphoto.image = imageBase64
}
convert JSON base64 to IMG
//convert base64ToImage
class func convertBase64ToImage(imageString: String) -> UIImage {
let imageData = Data(base64Encoded: imageString, options: Data.Base64DecodingOptions.ignoreUnknownCharacters)!
return UIImage(data: imageData)!
}

Cant decode Base64 string into image?

I have a Base64 string and want to turn it into an image, here is my func:
let imageString = speaker.image
if let decodedData = Data(base64Encoded: imageString, options: .ignoreUnknownCharacters) {
let image = UIImage(data: decodedData)
speakerCell.speakerImage.image = image
}
If I paste the below test code into a web browser, it decodes the image correctly, but the same string in the app fails.
It fails the if let and skips over, I can't understand why...
data:image/jpg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAA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DMOozms0ADa8RVR05xTbUhZRmm/d1QiOJtpwOlMul8qbjp1qk+qAuIdpGDwarwzY4IyD+ldmHxbjpIC62GHQVFvPQ9e1ejGanqguBHPNAGck9RV8o7jZCcUkrcUhlG8GVpLx+KEhXOf8AEIZ9LmRGwcA/hmpb1gVIPft61cdDOeqMjTZYxaADhgeSRmmpYttaaDhFPQnrRzxISZet4iqGeX77cKD2HrUQuWlXD8Hp9K5Zybdg2Kt8u7O0byeAKlchfmA5FaU5ESQyNFtrYQx/70jVTvpSiBeck8+9dSWhm2h+/JAXp3p9qu8k4HHOPpWcp2GlcrzQYtyCMn7xPqa2p7XNuLhMeW/XPY1KqMHAztHcBWUDIPTmiwIgkYNzk7QBxTqrnWg46G1akKxY4AxS2+duOMk+lcbdtGbo0xEi2u7qCcn0qeZglnEnPI54rlu7jGMoY/L3Ax7U/T1LTNIcAAAGlOVh3HxLsiYgcHgUty4DeWvIX1rPWQApG0DPSmKeBTtYolywHFMVueOaQF+2m2uD+FVFO0g9cc4pNAzr9HvCs8S546fSsSymO9cnGalSdzKcbntmhXSzwiBzl25H1rmfCdyzMjNkSAAg57V6eFxLpvQ8+vSTR6Vp42pg9elPtDlVPqM19JTqKcbo4LNMt0VQMUGmmgCxn5ajb7lAmIZAp5NZF5LIsuFp2Jua4k754rltS1C5t4mK44HrS2C50895FDGWkcKMeteG6/4nuppXRnbaPSuOeOpwdmLmPRtY8ZQxExWgDv0yTxXiE2supJUHPvXLPMH9kamup31/fz38m+6nIH90GvOm1qdhyTWEsa2aKulsdtPPDGDtx+dcJLqUrDk1jLENmixljor29XJ5/WuNuL2Rj1NYym2J4+XQ3pNS8tsqa5sO79zUXkiHjKjNu7ki1BQGA3diaq6dGdwJranJ9zCUpT3LKwx26EN1q9qFuJdOMnG5BzXo0pNdSfZsyjeJb39s6HknFYM0wlkgx1DV309UaQilueqLcFlBB6iqdm+61iJ/uim4nUmj/9k=
Remove data:image/jpg;base64, from the beginning, your code will work without it.
let imageString = speaker.image.replacingOccurrences(of: "data:image/jpg;base64,", with: "")

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 UIImage and Base64 string
After upload, I get this image:
[Failty image that is decoded from iOS converted base64 1
Instead of this:
[Correct image decoded from an online base64 conversion tool2
I tested the upload results using Postman and the back-end handles a valid base64 image correctly, so I narrowed the bug down to the base64 conversion itself. Here's my code:
public extension UIImage
{
func base64Encode() -> String?
{
guard let imageData = UIImagePNGRepresentation(self) else
{
return nil
}
let base64String = imageData.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength)
let fullBase64String = "data:image/png;base64,\(base64String))"
return fullBase64String
}
}
Any idea how I could fix my base64 output on my iOS device before I upload it to the server?
Do it something like this:
For Encoding:
data.base64EncodedStringWithOptions([])
For decoding:
let url = URL(string: String(format:"data:application/octet-stream;base64,%#",base64String))
do {
let data = try Data(contentsOf: url!)
}catch {
}
for Swift 4,
Do something like this,
For Encoding -
let imgObj = UIImage(named: "photo")
let imageData = UIImagePNGRepresentation(imgObj!)! as NSData
let base64 = imageData.base64EncodedData(options: .lineLength64Characters)
datatype of base64 variable is Data.

Base64 conversion with UIImage: NSData is not nil, but UIImage is nil

I am currently converting a user-picked UIImage to a base64 string using the below method, but when I go to convert that back into an image using the below method, I can get the NSData, but I can't convert that into a UIImage. Any thoughts? I have already tried using both PNG and JPEG methods for the UIImage, and neither worked if that adds any detail.
Thanks,
Jacob
Encoding Code:
var base64 = UIImagePNGRepresentation(self.profileView.image!))!.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength)
Decoding Code:
let decodedData = NSData(base64EncodedString: String(user?.photoURL), options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters)
let decodedimage = UIImage(data: decodedData!) //this decoded image is nil
You can try with code:
let image : UIImage = UIImage(named:"your_image")!
let imageData:NSData = UIImagePNGRepresentation(image)!
Encoding:
let base64:String = imageData.base64EncodedStringWithOptions(.Encoding64CharacterLineLength)
Decoding
let dataDecoded:NSData = NSData(base64EncodedString: base64, options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters)!
Here is the code to convert NSData to UIImage
let image: UIImage = UIImage(data:dataDecoded,scale:1.0)
I hope this helps.

Convert HEX String to UIImage

I have some request that returns a JSON string as the response.
I use the Alamofire framework, and in the function where I parse the JSON response:
if let img = jsonData["my_data"]["img"].string{
printl(img)
}
After that, I get the description
img = "\xffd8ffe000104a46494600010100000100010000ffdb0043000302020302020303030304030304050805050404050a070706080c0a0c0c0b0a0b0b0d0e12100d0e110e0b0b1016101113141515150c0f171816141812141514ffdb00430103040405040509050509140d0b0d1414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414ffc000110801e0035503012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a43444546474"
I need to convert this string into a UIImage. I tried doing it using the following code:
if let img = jsonData["status_order"]["img"].string {
let myData = img.dataUsingEncoding(NSUTF8StringEncoding)
// println(myData)
let base64String = myData!.base64EncodedStringWithOptions(.allZeros)
// println(base64String)
let decodedData = NSData(base64EncodedString: base64String, options: NSDataBase64DecodingOptions(rawValue: 0))
var decodedimage = UIImage(data: decodedData!)
println(decodedimage)
my_pic.image = decodeimage // I get nil
}
But after that I get some errors:
2015-09-18 18:57:14.363 taxi-admin[1520:3e03] ERROR: unable to get the
receiver data from the DB!
2015-09-18 18:57:16.822 taxi-admin[1520:4e03] ERROR:
ForceShrinkPersistentStore_NoLock -delete- We do not have a BLOB or
TEXT column type. Instead, we have 5.

Resources