title: Upload bitmap from memory via Retrofit
body: <p>I want to:</p>
  
  <ol>
  <li>Load a file from gallery or camera.</li>
  <li>Resize it.</li>
  <li>Upload gotten <code>Bitmap</code> to a server with request like "/api/file" via Retrofit.</li>
  </ol>
  
  <p>1 and 2 are made, I want to upload <code>Bitmap</code>. This request is POST (Accept: application/json, Content-Type: multipart/form-data). It receives files as a file, not text.</p>
  
  <p>I found many topics like <a href="https://futurestud.io/tutorials/retrofit-2-how-to-upload-files-to-server" rel="nofollow noreferrer">https://futurestud.io/tutorials/retrofit-2-how-to-upload-files-to-server</a>, <a href="https://stackoverflow.com/questions/45828401/how-to-post-a-bitmap-to-a-server-using-retrofit-android">How to POST a bitmap to a server using Retrofit/Android</a>, <a href="https://stackoverflow.com/questions/39953457/how-to-upload-image-file-in-retrofit-2">How to Upload Image file in Retrofit 2</a>, but don't undestand: </p>
  
  <p>1) should I save a <code>Bitmap</code> from memory to a <em>file</em> and upload,</p>
  
  <p>2) or can I upload it from memory as byte array or stream using Retrofit?</p>
  
  <p>If 2, how can I write a request?</p>