Reputation: 1
val decoder = new BASE64Decoder
val decodedBytes = decoder.decodeBuffer(base64String)
val uploadFile = "C:/Users/BabuSuku/Downloads/SpineorDownloads/test.png"
val image = ImageIO.read(new ByteArrayInputStream(decodedBytes))
val f = new Nothing(uploadFile)
ImageIO.write(image, "png", uploadFile)
Upvotes: 0
Views: 110
Reputation: 22545
you passed a string as third parameter to write
. You need a File
variable instead. Change the last two lines accordingly:
val decoder = new BASE64Decoder
val decodedBytes = decoder.decodeBuffer(base64String)
val uploadFile = "C:/Users/BabuSuku/Downloads/SpineorDownloads/test.png"
val image = ImageIO.read(new ByteArrayInputStream(decodedBytes))
val f = new File(uploadFile)
ImageIO.write(image, "png", f)
see Docs
Upvotes: 1