Someone knows how to encode large image in Base64 format. Because I
had tried using creating byte array as large as image size but if
image it encode image if size of image is upto 800kb, if image is
greater than 800kb then it throws runtime exception as
OutofMemoryException. So I had decided use 1kb of byte array, in that
I encode 1kb of image write to a file after that again encode 1kb of
image and write to a file .....  The code is like this

public void encodeImage()
        {
                try
                {
                        out = new PrintWriter("c:/program1/zzz.txt");
                        InputStream inputStream =  new FileInputStream
("c:/program1/
tt.jpg");
                        OutputStream outputStream = new
FileOutputStream("c:/program1/
zzz.txt");

                        byte[] b = new byte[1024];

                        while((read= inputStream.read(b))>0)
                        {
                                System.out.println ("Inside while");
                                inputStream.mark(b.length);
                                String encoded = Base64.encode(b);
                                //System.out.println (encoded);
                                out.print(encoded);
                                out.flush();

                                //bas.write(b);
                        }

                        out.close();

                }

                catch (Exception e)
                {
                        System.out.println (e);
                }

        }

But when I decode that image here 
http://www.opinionatedgeek.com/dotnet/tools/base64decode/
then it says that he input is not a valid Base-64 string.

Please help me to solve this issue.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to