Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6978005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:41:59+00:00 2026-05-27T17:41:59+00:00

I do need to send an image in android selected by the user to

  • 0

I do need to send an image in android selected by the user to a servlet. I do already have the selected images path in selectedImagePath variable. Now, I need to send that image along with some other information to the server. What I have done is:

Bitmap image = BitmapFactory.decodeFile(selectedImagePath);
int height = image.getHeight();
int width = image.getWidth();
int[] pixels = new int[width * height];
image.getPixels(pixels, 0, width, 0, 0, width, height);

My idea is to send the color values in the pixel array as comma separated string through XML. I think Integer.toHexString will be of helpful. For example:

<width>300</width>
<height>400</height>
<data>0xffffff,0xff00ff,0xffff00,...</data>

At the server side, decode the color values and create a BufferedImage and then save it to the file system using ImageIO.write.

Now, my question is:

  • Is it the correct way to do this?
  • Is there any other better and efficient way to do this?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:42:00+00:00Added an answer on May 27, 2026 at 5:42 pm

    Step-1 convert your bitmap image to byte array

    Step-2 encode the byte[] to Base64 and send

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a slow connection that I need to send a PNG image over
I need to send MMS thought a C# application. I have already found 2
I have some image processing Java code in Android that acts upon two large
Good day, i have a requirement where i need to send files(image/videos.. etc) through
I need to resize/crop images in different resolutions for Android App. I know, that
I need send certain attributes(say, human readable user name) from server to client after
I would like to capture an image from the camera on Android, and send
I have an Android app that saves a text file directly onto the phone,
I have a gallery that shows an array of images, when clicked they are
I need to send large amounts of data (image files) by POST in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.