here is my java code that construct the base64 String from image. Then place the base64 String html, to view
the constructed image, but image is not constructed somehow
public void getBase64String() throws FileNotFoundException {
FileInputStream itStrm = new FileInputStream(
"E:\\image\\56255254-flower.jpg");//image is lying at http://danny.oz.au/travel/mongolia/p/56255254-flower.jpg
String str = itStrm.toString();
byte[] b3 = str.getBytes();
String base64String = new sun.misc.BASE64Encoder().encode(b3);
//output of base64String is amF2YS5pby5GaWxlSW5wdXRTdHJlYW1AMTdlMDYwMA==
}
Now in html page i placed the output of base64String in img tag to view the image.But image does not shows up
(instead it display the cross image icon). I am not getting image is not displayed from base64 String below?
<HTML>
<BODY>
<img src="data:image/jpeg;base64,amF2YS5pby5GaWxlSW5wdXRTdHJlYW1AMTdlMDYwMA=="/>
</BODY>
</HTML>
EDIT:- Thanks Folks, i used byte[] bytes = IOUtils.toByteArray(is);. It worked for me!!
This: String str = itStrm.toString() is not the image but the toString() representation of the FileInputStream instance.
You'll have to read the bytes from the stream and store them in a byte array. And, for performance reasons, buffer the stream:
BufferedInputStream itStrm = new BufferedInputStream(FileInputStream(
"E:\\image\\56255254-flower.jpg"));
Further reading (Spoiler: solution inside)
Convert InputStream to byte array in Java
You would need to use the read() method of the FileInputStream instance instead of the toString() to get the content of the image. Then you are able to encode it and should work as you expected.
Something like:
int c;
StringBuffer result = new StringBuffer("");
while((c = fileInputStream.read()) != -1)
{
result .append((char)c);
}
Related
I have a requirement where i have set of base64 strings each string is one tiff file, i need to combine all these base64 strings and provide this full tiff data as base64 string, so end user can create a tiff file from the combined base64 strings.
I tried all the ways shared below but each time in my output tiff only one page is coming but i am passing 2 base64 strings.
Any inputs greatly appreciated.
Iam using this code
ArrayList al = new ArrayList();
//this is repetative so i am adding all the base64 strings to arraylist
byte[] imgBytes = Base64.decodeBase64(imageObject.get("image").toString());
al.add(imgBytes);
//writing all base64 strings to a new tiff file //here it is showing only the first page but in the top i am adding two pages.
BufferedImage imag=ImageIO.read(new ByteArrayInputStream(toByteArray(al)));
ImageIO.write(imag, "tif", new File(processedFilesFolder,"combined.tif"));
public static byte[] toByteArray(List<byte[]> bytesList)
{
int size = 0;
for (byte[] bytes : bytesList)
{
size += bytes.length;
}
ByteBuffer byteBuffer = ByteBuffer.allocate(size);
for (byte[] bytes : bytesList)
{
byteBuffer.put(bytes);
}
return byteBuffer.array();
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream( );
outputStream.write( data ); // this line is repetative
byte c[] = outputStream.toByteArray( );
try (OutputStream stream = new FileOutputStream("C:\\Users\\XYZ\\Desktop\\EID_Image_DesktopScan_mod.tiff")) { stream.write(c); } catch(Exception e){}
Regards,
Meerasaaheb Mohmmad
Issues in converting base64 decoded byte array to String in java :
public static String decode(String strcontent) throws Exception
{
BASE64Decoder decoder = new BASE64Decoder();
byte[] imgBytes = decoder.decodeBuffer(strcontent);
return new String(imgBytes);
}
With the above code; was trying to create a string out of the Base 64 decoded byte array (imgBytes ) & input strcontent is base 64 encoded string. For text files it working fine , but for PDF and image files the string conversion is having issues. Have tried different encoding as UTF-8 , UTF 16 etc. But no use. The returned string is different than the original one.
When tried to write the byte array to a file like :
OutputStream out = new FileOutputStream(##path);
out.write(imgBytes);
out.close();
File is getting created properly without any issues.
I tried the below code:
byte[] imgBytes= ( new String(imgBytes1)).getBytes(); //Converting to String and back to bytes
OutputStream out = new FileOutputStream(##Filename);
out.write(imgBytes); out.close();
This time the image file is corrupted.
Please suggest.
I need to encode/decode pdf file into Base64 format.
So I read file from disk into String(because I will receive file in String Base64 format in future);
String pdfString = IOUtils.toString(new FileInputStream(new
File("D:\\vrpStamped.pdf")));
byte[] encoded = Base64.encodeBase64(pdfString.getBytes());
byte[] newPdfArray = Base64.decodeBase64(encoded);
FileOutputStream imageOutFile = new FileOutputStream(
"D:\\1.pdf");
imageOutFile.write(newPdfArray);
imageOutFile.close();
imageOutFile.flush();
So my D:\\1.pdf doesnt opens in AdobeReader, but if I read file straight to byte array, using IOUtils.toByteArray(..) instead ,all works fine and my D:\\1.pdf file sucessfuly opens in Adobe Reader:
byte[] encoded = Base64.encodeBase64(IOUtils.toByteArray(new FileInputStream(new File("D:\\vrpStamped.pdf"))););
It seems to me thath IOUtils.toString(..) change something inside file content. So how can I convert file to String with not content breaking?
How to encode a pdf...
byte[] bytes = IOUtils.toByteArray(new FileInputStream(new File("/home/fschaetz/test.pdf")));
byte[] encoded = Base64.encode(bytes);
String str = new String(encoded);
...now do something with this encoded String, for example, send it via a Rest service.
And now, if you receive an encoded String, you can decode and save it like this...
byte[] decoded = Base64.decode(str.getBytes());
FileOutputStream output = new FileOutputStream(new File("/home/fschaetz/result.pdf"));
output.write(decoded);
output.close();
Works perfectly fine with all files, not limited to images or pdfs.
What your example is doing is...
Read the pdf into a String (which pretty much destroys the data, since you are reading binary data into a String)
Encode this spring (which is in all likelyhood not a valid representation of the original pdf anymore)
Decode it and save it to disk
how to convert gif to base64?
here's what i try so far
public static String convertImageToBase64(String urlString, String type ){
String imageString = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
URL url = new URL(urlString);
BufferedImage img = ImageIO.read( url );
ImageIO.write(img, type, bos);
byte[] imageBytes = bos.toByteArray();
BASE64Encoder encoder = new BASE64Encoder();
imageString = encoder.encode(imageBytes);
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
return imageString;
}
code above is working, but it lost the animation
Most likely the class BufferedImage does not support images with animation. So the code opens and parses the image only to the first frame.
Instead try directly getting the bytes with URL.openStream and then just convert the downloaded bytes to base64.
Notice that this way you can't be sure that the downloaded file is actually an image since you are not opening it at all. This may or may not be needed.
You have to use
public String encodeToString(byte[] src)
of class BASE64.Encoder (from java 8)
I'm assuming what you want is a Base64 representation of the GIF file itself, not the ImageIO representation. If you have an older version of Java without built-in Base64 support, Apache Commons Codec will do the job. Read the file into a byte array using URL.openStream(), not with ImageIO, then call Base64.encodeBase64String. If you want the result URL encoded, call Base64.encodeBase64URLSafe instead.
If you actually want the ImageIO representation, then you're stuck with losing the animation.
I am struggling with base64.
I would like to decode an image which comes though wysiwyg editor.
I build a source like below.(it is part of...)
InputStream is = request.getInputStream();
byte b[] = IOUtils.toByteArray(is);
String base64DataString = Base64.encodeBase64String(b);
String aaa = Base64.encodeBase64URLSafeString(b);
base64DataString = "data:image/" + ext + ";base64," + aaa;
if(aaa == "a"){}
if(is != null) {
is.close();
}
I got InputStream from request and make it as byte array.
size of byte[] b is exactly same with size of file I uploaded.
Then I combine a String to put src attribute of image tag.
After all of this when I look at in HTML. It has a broken image.
output looks like below :
<img src="data:image/jpeg;base64,_9j_4AAQSkZJRgABAQAAAQABAAD_2wCEAAkGBhQSERQUExQWFRUWGBgaGRgYFxwcGBwYFxwcGxgYGxoaHSYfHRwjGhUYHy8gIycpLCwsGB8xNTAqNSYrLCkBCQoKDgwOGg8PGi0kHyQsLCwsLCwuLCwsLywsLCwsLCwsLCwsLCwsLCksLCwsLCwsLCwsLCwsLCwsLCwsLCwsLP_AABEIAMIBAwMBIgACEQEDEQH_xAAcAAACAgMBAQAAAAAAAAAAAAAEBQMGAAECBwj_xABJEAABAwIDBAcDCAgDBwUAAAABAgMRACEEEjEFQVFhBhMicYGRoTKxwQcUQlJigtHwIzNykqKy0uEWc_EVNENEY5PCFyRTg6T_xAAbAQADAQEBAQEAAAAAAAAAAAACAwQBAAUGB__EADERAAIBAwMCBAQGAwEBAAAAAAABAgMRIRIxQRNRBCJhkXGhsfAFFFKB4fEyQtHBkv_aAAwDAQACEQMRAD8A3imEtCxPcEonzT8aru2GsOtehJt9Ig-QNAu4JeoQV8ogeakfGmOA7ABWyhs8S7J8gLeZqmThPl__ACUpSh8fiALwa0x83UUAi4OY-9UCjcF0cdVBUQeXVie_MVKNMBjmVHWD3qM92-abr24UtpCUrA49YNO6bd1ap6VdLHxaAnd4e_wK-90fcT2VqvwEDzkisZ2AsqAJWgcg3-Bo9_aSlG2bvzg_A1A5h3nDJYUsDVQQkGOZUUiuVVTd7fO52lwVr2_YXbb2aoFKGhmGgktye4Zh7qnwvRd2P0uVJVBAKUH-QUDjmCl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SJ9KJVJHaCfov0k6ppLGI7OVICHPoqyiBm-qqONjFjeKcDHpJsQQd4uPOkJdQoCbWtIgxxvuPupa_g0oOZtRQfsmAe8aHxFNjLuieVHOC9tYtMXrheLF71S2tpPDehXeCPcYqN7aOIVopCO4Sf4p91H5QenMuTmOFKsX0qZRILgJ4DtHyTNVksqcHbcUrkTbyECto2ekaeVC7INU3yxoemyCbIcV92PeRUa-mwH_AAnP4f6qXnBAGwFYvBgisduwxQXcJPTn_oufvI_qrKCGBHKsoL-gWmPc9SaSOFEpSKysr6NnykSdKRwrMg4CsrKEMzKOFclA4CsrKwwzIOArZbE6DdurdZWM1ETzYtYacKXLaF7DXhWVlYjXubS2OA8q7WkcKyspMimGwMtInStpTWVlCwjoisArKyhNR1lHCsyDgKysoGGjZaHAeVDPMpnQacKysoeQrgbzCfqjyFCqZTwHlWqyhaGxbIHGk8B5d1CuNi1hod1ZWUKQ1MFxDQgCBEcKExDKfqjyFZWVj3GJnDKYmOFRLF_zyrdZQ8lHARFvvD3VpSjfvHurKyuFAylmdTpWs5jU1lZRoxirFPqzntHzNbrKylmn_9k
" title="gaebul.jpeg">
What is the suspicious part of my code?
Thanks for sweet answer :D bb
You seem to be encoding two times without the real need, you should just do
byte[] encodeBase64 = Base64.encodeBase64(b);
String base64DataString = new String(encodeBase64 , "UTF-8");
and than just
src="data:image/jpeg;base64,[the value of your base64DataString]"