• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BASE64

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
i get the Base64 type image.i want to save it on server using jsp.
to convert this in ordinary graphics file which classes can i use for encoding and decoding.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
base-64 is not an image type - it's an encoding used to convert binary content into ASCII. The Apache Commons Codec library has routines for en- and decoding base-64.
 
Ratan Pawar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How i can save this base64 string as a image.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where you successful running the base-64 decoder? Is the result a valid image file?
 
Ratan Pawar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes,decoding is successful.
now i want to save it as image file.what should i use for it.
i tried imageio but how pass correct parameter or what other things for saving it as image.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What did the base-64 decoder hand back to you - a byte array? If so, you can use a FileOutputStream to write the bytes to a file.
 
Ratan Pawar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes its working.
Thank you very much Sir.
 
Ratan Pawar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir,Now i can show this saved images to the client.
I used FileInputReader for read the file.
and then encode it.is required to encode now?
Because now we want to show only that saved image.
when i put it ac image it not show the image.
i also used ListFiles to read the names of file in folder.
it is successful but it not shows as a image.
what to do?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I used FileInputReader for read the file. and then encode it.is required to encode now?


An encoded image can't be displayed, so, no, encoding is not only not required, it is harmful, because it prevents the image from being used elsewhere.

i also used ListFiles to read the names of file in folder.
it is successful but it not shows as a image.


What is "it"? A web page? An AWT/Swing component? Is this still a version of the image that is encoded? I thought you said you were successful decoding it.
 
Ratan Pawar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir,i want do display image in web page.
I did it successfully.I read the saved file name from the directory
and then it filename give as source for the image.its working.
No need of Decoding.
if i want to write it on canvas then i think decoding is required.
Thank you Sir.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if i want to write it on canvas then i think decoding is required.


Once you decode the image and store it, it is no -obviously- no longer encoded. It has to be, because it couldn't be displayed otherwise. So I don;t understand why you think another decoding step might be necessary.
 
reply
    Bookmark Topic Watch Topic
  • New Topic