Create BufferedImage from Base 64 Encoded String

Hello,

I'm trying to convert a base 64 encoded String (see below) and convert that into a BufferedImage in order to write it to the file system.  I'm converting first to an InputStream which works ok but then when I convert the InputStream to a BufferedImage it fails.  No Exception, just null.  

byte[] decodedBytes = decoder.decodeBuffer(encodedString);
InputStream is = new ByteArrayInputStream(decodedBytes);
BufferedImage originalImage = ImageIO.read(is);  // original Image is null


/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABELDA8MChEPDg8TEhEUGSobGRcXGTMkJh4qPDU/Pjs1OjlDS2BRQ0daSDk6U3FUWmNma2xrQFB2fnRofWBpa2f/2wBDARITExkWGTEbGzFnRTpFZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2f/wAARCAYACAADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDo6KKSrJYUd6KKV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DbzS4ozmgApDS0maLjsKORSc5paBQAYxSYApTx+NIBmgQdelLjikHWlzQAYo59KUGkB460ID0zFJ3p1N61ZIdqB70AUopCEApRQOaKAuJRS4ooATHOaXFFHWgAFFLRQAY70CiigAoHNBooACKQUUDpQAYpKWk60DClFJQKAFptLTSaBMSmmnGmmmIYaaacabTENxSU4mmmmIQ96ifpUhqKU8U0JsgbvSAmhmpAeKtGbY49KYQRQWxj3oz70CuNIJprZUE0pPOaQnNNCZHnmlxQT2xQaogQHnFLjvSA9KD145oHcAcEGik5oHWgLi0p7UhbGTijrRYLi96OaKUE+lAXAdKKAc0Y4pDGkZ7UooNA5oFYSgUowM5phbg4GaYnoKKUHNA5FAweKBoduGeeab3oxzQTmgLgThhwaXv60Ak/jSYoAXjOcUA0maOvaiwrjvenIM9aaDSg0hjgvPFTwpnrUKZ/OrUWNtSy4oZIKYDUknI96jAwKSGxG/OnDpTDyacDxQJDxQTSZ4pu6gYtRycU/dmo3poTGUnOOtKD60VRmAGaAcilB9KAeKAsCrSigGloHZCDvSrz0pOtKOKQDlpRzSDrSj2pFocFpy/SmjkU4dKQxwpy0i4xThSKQq08CmqKcoqSkKBinikApy0ikKOaUUCikMTOKYxpzVG1NCYxz/APrqFjj3p7mojzVpGbkITmm8UDPcUVRncUdqcOTTB1FPUUDRLGKlqOKnkVDNUAFPpq08VIw7U006m/WgYlIeaU0dqYhtA60d6KBC0UUCgYCiijNAgFAoFHegYtJRRmkAoopAaWgYhppHFONIaaEyJ+lRU+TNR96tGTDtRQKMUyRjxCXkYB6c96i+zPz8vHqKsDrS/WocEzWNRopSRFTgjmmmPtV11V8bhnFRToEUMvToaylCxpGaZXjQr1OabdR+bEyj73UfWpQe1Hf1xWbNCqiHO4jDMBuBpyYyQpBI9KfINrA9jWf
cgray1223Asked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
Yes, you should URLEncode it
0
 
CEHJCommented:
Something a little strange about the image itself. This is what i get (you can see behind a text output of the byte array)
weird.png
0
 
for_yanCommented:
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
CEHJCommented:
This is what imagemagick has to say about it:
goose@hpbrio:/tmp$ identify x.jpg
x.jpg JPEG 2048x1536 2048x1536+0+0 DirectClass 8-bit 2.95703kb 1.420u 0:03
identify: Premature end of JPEG file `x.jpg'.
identify: Corrupt JPEG data: premature end of data segment `x.jpg'.

Open in new window

0
 
cgray1223Author Commented:
hmm, maybe the format of the image string is bad...
I used http://www.dailycoding.com/Utils/Converter/ImageToBase64.aspx to create the base 64 representation.  I tried a different image (see below) and I get javax.imageio.IIOException: Invalid JPEG file structure: two SOF markers

Is there a particular format or conversion I'm missing?



/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAEPATgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUv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8Aguh/+JroKKAOf/4QTwf/ANCpof8A4Lof/iaP+EE8H/8AQqaH/wCC6H/4mugooA5//hBPB/8A0Kmh/wDguh/+Jo/4QTwf/wBCpof/AILof/ia6CigDg/Gngvwra+BfENxb+GtGhni0y5eOSOwiVkYRMQQQuQQec0VueO/+SeeJf8AsFXX/opqKADwJ/yTzw1/2CrX/wBFLXQVz/gT/knnhr/sFWv/AKKWugoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA5/x3/wAk88S/9gq6/wDRTUUeO/8AknniX/sFXX/opqKADwJ/yTzw1/2CrX/0UtdBXP8AgT/knnhr/sFWv/opa6CgAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigDn/Hf/JPPEv/AGCrr/0U1FHjv/knniX/ALBV1/6KaigA8Cf8k88Nf9gq1/8ARS10Fc/4E/5J54a/7BVr/wCilroKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAOf8d/8AJPPEv/YKuv8A0U1FHjv/AJJ54l/7BV1/6KaigA8Cf8k88Nf9gq1/9FLXQVz/AIE/5J54a/7BVr/6KWugoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA5/x3/yTzxL/wBgq6/9FNRR47/5J54l/wCwVdf+imooAPAn/JPPDX/YKtf/AEUtdBXP+BP+SeeGv+wVa/8Aopa6CgAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigDn/Hf/ACTzxL/2Crr/ANFNRR47/wCSeeJf+wVdf+imooAPAn/JPPDX/YKtf/RS10Fc/wCBP+SeeGv+wVa/+ilroKACiiigAooooAKKKKACiiigAooooAKKKKAOC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/AKKWugoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA5/x3/wAk88S/9gq6/wDRTUUeO/8AknniX/sFXX/opqKADwJ/yTzw1/2CrX/0UtdBXP8AgT/knnhr/sFWv/opa6CgAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigDn/Hf/JPPEv/AGCrr/0U1FHjv/knniX/ALBV1/6KaigA8Cf8k88Nf9gq1/8ARS10Fc/4E/5J54a/7BVr/wCilroKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAOf8d/8AJPPEv/YKuv8A0U1FHjv/AJJ54l/7BV1/6KaigA8Cf8k88Nf9gq1/9FLXQVz/AIE/5J54a/7BVr/6KWugoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA5/x3/yTzxL/wBgq6/9FNRR47/5J54l/wCwVdf+imooAPAn/JPPDX/YKtf/AEUtdBXk/hP4v+BNM8G6HYXmu+XdWun28MyfZJztdY1DDITBwQelbH/C7fh5/wBDD/5JXH/xugD0CivP/wDhdvw8/wChh/8AJK4/+N0f8Lt+Hn/Qw/8Aklcf/G6APQKK8/8A+F2/Dz/oYf8AySuP/jdH/C7fh5/0MP8A5JXH/wAboA9Aorz/AP4Xb8PP+hh/8krj/wCN0f8AC7fh5/0MP/klcf8AxugD0CivP/8Ahdvw8/6GH/ySuP8A43R/wu34ef8AQw/+SVx/8boA9Aorz/8A4Xb8PP8AoYf/ACSuP/jdH/C7fh5/0MP/AJJXH/xugD0CivP/APhdvw8/6GH/AMkrj/43R/wu34ef9DD/AOSVx/8AG6APQKK8/wD+F2/Dz/oYf/JK4/8AjdH/AAu34ef9DD/5JXH/AMboA9Aorz//AIXb8PP+hh/8krj/AON0f8Lt+Hn/AEMP/klcf/G6APQKK8//AOF2/Dz/AKGH/wAkrj/43R/wu34ef9DD/wCSVx/8boA9Aorz/wD4Xb8PP+hh/wDJK4/+N0f8Lt+Hn/Qw/wDklcf/ABugD0CivP8A/hdvw8/6GH/ySuP/AI3R/wALt+Hn/Qw/+SVx/wDG6APQKK8//wCF2/Dz/oYf/JK4/wDjdH/C7fh5/wBDD/5JXH/xugD0CivP/wDhdvw8/wChh/8AJK4/+N0f8Lt+Hn/Qw/8Aklcf/G6APQKK8/8A+F2/Dz/oYf8AySuP/jdH/C7fh5/0MP8A5JXH/wAboA9Aorz/AP4Xb8PP+hh/8krj/wCN0f8AC7fh5/0MP/klcf8AxugD0CivP/8Ahdvw8/6GH/ySuP8A43R/wu34ef8AQw/+SVx/8boA9Aorz/8A4Xb8PP8AoYf/ACSuP/jdH/C7fh5/0MP/AJJXH/xugD0CivP/APhdvw8/6GH/AMkrj/43R/wu34ef9DD/AOSVx/8AG6AOg8d/8k88S/8AYKuv/RTUVxXif4teB9a8J6zpWn63517e2M9tbxfZJl3yOhVVyUAGSQMkgUUAf//Z
0
 
CEHJCommented:
Your last one works fine for me and imagemagick doesn't say it's corrupt
0
 
cgray1223Author Commented:
Thanks for the reply CEHJ.  How are you creating the BuggeredImage?  I'm using the below steps, buts its null for me.

byte[] decodedBytes = decoder.decodeBuffer(encodedString);
InputStream is = new ByteArrayInputStream(decodedBytes);
BufferedImage originalImage = ImageIO.read(is);  
0
 
CEHJCommented:
Just like that. Perhaps you ought to check the input param at each step...
0
 
cgray1223Author Commented:
What's happening is that the parts of the String like "/hP4v+" are getting converted to "/hP4v  " with a space at the end.  The image base 64 string is being sent over as a String in a form param. Will URLEncoding handle this?
0
 
CEHJCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.