Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your writing the image to a file output stream on your client side, which will store the contents into a physical file. You are then trying to convert the <code>toString</code> representation of <code>FileOutputStream</code> as the image content. This won't work, the <code>toString</code> method of that class doesn't give you the contents that were written to the stream, it just prints a barely helpful message like this:</p> <blockquote> <p>java.io.FileOutputStream@761eec35</p> </blockquote> <p>I believe what you intended to do was use a <code>ByteArrayOutputStream</code> - this class <strong><em>does</em></strong> allow you to retrieve the actual contents written via its <code>toString</code> method.</p> <p>On Android side (snippet):</p> <pre><code>Bitmap bm = Bitmap.createBitmap(gestureView.getGesture().toBitmap(100, 100, 8, Color.WHITE)); ByteArrayOutputStream baos = new ByteArrayOutputStream(2056); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] imageBytes = baos.toByteArray(); String encodedString = Base64.encodeToString(imageBytes, Base64.DEFAULT); </code></pre> <p>On server side (snippet):</p> <pre><code>String imageString = request.getParameter("SignatureImage"); byte[] decodedBytes = Base64.decode(imageString, Base64.DEFAULT); try { InputStream in = new ByteArrayInputStream(decodedBytes); BufferedImage bImageFromConvert = ImageIO.read(in); ImageIO.write(bImageFromConvert, "png", new File( "E:/signature/signature.png")); } catch (IOException e) { e.printStackTrace(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload