Yesterday I wrote a working code for this, but I erased it and when writing a new one something is really weird:
I encode it a picture this way:
let pictureData = UIImagePNGRepresentation(picture!)
let pictureToString64 = pictureData?.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength)
(I had JPEGRepresentation before, but it wasn't working, so I tried with JPEG)
and I decode this way by getting pic 64 which I believe it has the correct value. It starts with iVBORw0KGgoAAAANSUhEUgAAAUAA(...)
let decodedData = NSData(base64EncodedString: pic64, options:NSDataBase64DecodingOptions(rawValue: 0))
let decodedImage = UIImage(data: decodedData!)
let pictureDataLocal = UIImageJPEGRepresentation(decodedImage!, 100)
defaults.setObject(pictureDataLocal, forKey: "profilePicture")
The problem is that decodedData is always nil. Why is this happening?
I think this has to do with NSDataBase64DecodingOptions.
Using NSDataBase64DecodingOptions.IgnoreUnknownCharacters instead of NSDataBase64DecodingOptions(rawValue: 0), I was able to decode the Base64 encoded string back into NSData, and created a UIImage from that data:
let picture = UIImage(named: "myImage")
let pictureData = UIImagePNGRepresentation(picture!)
let pictureToString64 = pictureData?.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength)
let decodedData = NSData(base64EncodedString: pictureToString64!, options:NSDataBase64DecodingOptions.IgnoreUnknownCharacters)
let decodedImage = UIImage(data: decodedData!)
let pictureDataLocal = UIImageJPEGRepresentation(decodedImage!, 100)
NSDataBase64DecodingOptions inherits from OptionSetType which is why you get the rawValue initializer. It is better to use the one of the set types, rather passing in a value. I saw in the header that NSDataBase64DecodingOptions was the only public var in the struct, so I tried it.
#available(iOS 7.0, *)
public struct NSDataBase64DecodingOptions : OptionSetType {
public init(rawValue: UInt)
// Use the following option to modify the decoding algorithm so that it ignores unknown non-Base64 bytes, including line ending characters.
public static var IgnoreUnknownCharacters: NSDataBase64DecodingOptions { get }
}
Related
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/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB26ADAAQAAAABAAABDwAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/8AAEQgBDwHbAwESAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/bAEMABgQFBgUEBgYFBgcHBggKEAoKCQkKFA4PDBAXFBgYFxQWFhodJR8aGyMcFhYgLCAjJicpKikZHy0wLSgwJSgpKP/bAEMBBwcHCggKEwoKEygaFhooKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo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2Rj1NYym2J4+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: "")
I am using CoreData for an app. I have set image as BinaryData in data model. But I have fetched image from server as UIImage and it throws error as:
cannot assign value of type 'UIImage?' to type 'NSData?
I searched but couldn't find any resemblance solution for it. Can anyone help me in swift 3?
My code is:
let url1:URL = URL(string:self.appDictionary.value(forKey: "image") as! String)!
let picture = "http://54.243.11.100/storage/images/news/f/"
let strInterval = String(format:"%#%#",picture as CVarArg,url1 as CVarArg) as String as String
let url = URL(string: strInterval as String)
SDWebImageManager.shared().downloadImage(with: url, options: [],progress: nil, completed: {[weak self] (image, error, cached, finished, url) in
if self != nil {
task.imagenews = image //Error:cannot assign value of type 'UIImage?' to type 'NSData?'
}
})
The error message is pretty clear - you cannot assign UIImage object to a variable of NSData type.
To convert UIImage to Swift's Data type, use UIImagePNGRepresentation
var data : Data = UIImagePNGRepresentation(image)
Note that if you're using Swift, you should be using Swift's type Data instead of NSData
You must convert, image into Data (or NSData) to support imagenews data type.
Try this
let url1:URL = URL(string:self.appDictionary.value(forKey: "image") as! String)!
let picture = "http://54.243.11.100/storage/images/news/f/"
let strInterval = String(format:"%#%#",picture as CVarArg,url1 as CVarArg) as String as String
let url = URL(string: strInterval as String)
SDWebImageManager.shared().downloadImage(with: url, options: [],progress: nil, completed: {[weak self] (image, error, cached, finished, url) in
if self != nil {
if let data = img.pngRepresentationData { // If image type is PNG
task.imagenews = data
} else if let data = img.jpegRepresentationData { // If image type is JPG/JPEG
task.imagenews = data
}
}
})
// UIImage extension, helps to convert Image into data
extension UIImage {
var pngRepresentationData: Data? {
return UIImagePNGRepresentation(img)
}
var jpegRepresentationData: Data? {
return UIImageJPEGRepresentation(self, 1.0)
}
}
//To encode I found the following example. I don't know if it works yet
#IBAction func exitImageViewController(seque:UIStoryboardSegue){
let imageController = seque.destination as! MyImageViewController
let myView = imageController.imageView
imageData = UIImagePNGRepresentation((myView?.image!)!)
imageString = imageData?.base64EncodedString()
// Is this swift code correct?
//I cannot find an example of decoding String back to UIImage
The code you posted looks fine. To encode back you can do this:
let data = Data(base64Encoded: imageString!)
let img = UIImage(data: data!)
I have a base64String that I need to convert into a UIImage() and display in a UIImageView. I've been trying for hours to convert it, but I keep getting nil from UIImage(data: data). When I print(data)it looks normal, but I can't decode it properly into an image. What's going on, and why is this code not working?
let base64String = "data:image/x-icon;base64,AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAA2Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf88IjD/XUlU/2RRW/9GLzv/kouQ/6Sdn/84Hiz/RCs4/0QrOP82Gyn/Nhop/0UtOv9FLDr/OR8t/zYaKf85Hyz/ubO2////////////7+/v//////+6tbb/RS47/+bl5v/Py87/OR4s/0gxPf/z8/P/vrq8/1dFTv82Gin/a1xk//////+4s7f/hnuB//b29v/+/v7/SjdC/0EoNv/5+Pn/39zg/zgdK/9oWGD//////5OIjf9ELTn/Nhop/6CYnP//////X0xW/zYaKf/Cvb///////0czPv9AJzX/9vX2/+Dc3/86Hy7/lIqP//////9jUlr/OB0s/zYaKf+qpKb//////2ZSXf82Gin/zcbJ//////9RPkf/QCc1//X19f/c2Nv/Pyc0/8nGyP/8/Pz/RzA8/zYaKf82Gin/q6Wn//////9kUVv/Nhop/83Gyf//////UD1G/0AnNf/19fX/1NDT/0w4RP/5+fn/zcnL/zkfLf82Gin/Nhop/6ulp///////ZFFb/zYaKf/Nxsn//////1A9Rv9AJzX/8fDx//n4+f/U0NP//////6GYnP82Gin/Nhop/zYaKf+rpaf//////2RRW/82Gin/zcbJ//////9QPUb/QCc0//Dv7///////+vr6///////39vf/RzM//zYbKf82Gin/q6Wn//////9kUVv/Nhop/83Gyf//////UD1G/0AnNP/19PT/4N3e/0s0QP+HfIL//////5uRlv9HLzv/Nhop/6ylp///////ZFFb/zYaKf/Nxsn//////1A9Rv9AJzT/9fX1/9zZ2v85Hiz/VD9K//////+7tLf/VkJM/zYaKf+po6X//////2RRW/82Gin/xb3C//////9OPEX/QCc0//b19f/c2tr/OR4s/1I9SP//////t7Gz/1M/SP82Gin/joWJ//////98b3b/Ri47/9XS1P//////STI+/0MpNv/y8fH/6+np/3FfaP+poab//////46Dif9CKjf/Nhop/0c0P//39vf///////r6+///////pp+k/zYaKf9GLjr/8O/v//////////////////Dv7/9AKjb/Nhop/zYaKf82Gin/UkBJ/7Osrv/DvsD/joSJ/zkhLv82Gin/PCIw/35wdv+GeH7/hHd8/39yef9HMT3/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/Nhop/zYaKf82Gin/AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//w="
let decodedData = NSData(base64EncodedString: base64String, options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters)
print(decodedData) // prints out fine
let image = UIImage(data: decodedData!) // keep getting nil here
use this function for decode Base64 String to String
public func decodebase64(str : String) -> String{
let decodedData = NSData(base64EncodedString: str, options:NSDataBase64DecodingOptions(rawValue: 0))
let decodedString = String(data: decodedData!, encoding: NSUTF8StringEncoding)
return decodedString!}
then use this function in this way
let newimage:String? = decodebase64(busimage)
if (newimage?.characters.count != 0)
{
ImageLoader.sharedLoader.imageForUrl(newimage!) { (images, url) -> () in
if (images != nil)
{
cell.compnylogo.image = images!
}
}
}
here you have to just use. or drag and drop this swift file.
Use this image Loader File this will help you
There are a lot of similar questions but non of them helped me out so I just don't know what to do but ask. So this is how I encode a UIImage:
let data: NSData = UIImagePNGRepresentation(imageResized)!
let base64String: NSString = data.base64EncodedStringWithOptions(.Encoding64CharacterLineLength)
and decoding (as suggested here):
if let range = base64.rangeOfString("data:image/png;base64,", options: .AnchoredSearch) {
base64.removeRange(range)
}
let decodedData = NSData(base64EncodedString: base64, options: NSDataBase64DecodingOptions(rawValue: 0))
if let decodedImage = UIImage(data: decodedData!) {
self.imageList.append(decodedImage)
}
But the app crashes when initializing decodedData and I can't figure out why.
I checked my base64 string here and it returns the picture.
Any help will be very appreciated!
Try with this:
if let decodedData = NSData(base64EncodedString: base64, options:NSDataBase64DecodingOptions.IgnoreUnknownCharacters){
if(decodedData.length > 0){
let imageDecodeData = UIImage(data: decodedData)!
}
else{
print("error")
}
}
Replace the line with let decodedData with:
let decodedData = NSData(base64EncodedString: base64, options: [])
And also make sure that your using correct variables:
// 1. This should be a variable if you're mutating it.
let base64String = data...
// 2. You should probably do this on your base64String
if let range = base64.rangeOfString(...)