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 7091915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:14:50+00:00 2026-05-28T08:14:50+00:00

How can I convert image to binary data ..??? I want to send that

  • 0

How can I convert image to binary data..???

I want to send that converted binary data to
another device or to the web server.

Which mechanism is best 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-28T08:14:51+00:00Added an answer on May 28, 2026 at 8:14 am

    I found a good example for uploading the image to the server.

    • create a bitmap variable before do anything.
    • variable to set a name to the image into SD card.
    • this variable, you have to put the path for the File, It’s up to you.
    • sendData is the function name, to call it, you can use something like
      sendData(null).
    • remember to wrap it into a try catch.
    private Bitmap bitmap;
    public static String exsistingFileName = "";
    
    public void sendData(String[] args) throws Exception {
        try {
            HttpClient httpClient = new DefaultHttpClient();
            HttpContext localContext = new BasicHttpContext();
    
            // here, change it to your php;
            HttpPost httpPost = new HttpPost("http://www.myURL.com/myPHP.php");
            MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
            bitmap = BitmapFactory.decodeFile(exsistingFileName);
    
            // you can change the format of you image compressed for what do you want;
            // now it is set up to 640 x 480;
            Bitmap bmpCompressed = Bitmap.createScaledBitmap(bitmap, 640, 480, true);
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
    
            // CompressFormat set up to JPG, you can change to PNG or whatever you want;
            bmpCompressed.compress(CompressFormat.JPEG, 100, bos);
            byte[] data = bos.toByteArray();
    
            // sending a String param;
            entity.addPart("myParam", new StringBody("my value"));
    
            // sending a Image;
            // note here, that you can send more than one image, just add another param, same rule to the String;
            entity.addPart("myImage", new ByteArrayBody(data, "temp.jpg"));
            httpPost.setEntity(entity);
            HttpResponse response = httpClient.execute(httpPost, localContext);
            BufferedReader reader = new BufferedReader(new InputStreamReader(   response.getEntity().getContent(), "UTF-8"));
            String sResponse = reader.readLine();
    
        } catch (Exception e) {
            Log.v("myApp", "Some error came up");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I stored my image data in a binary field in sql server and now
I'm trying to make a C++ console app that can convert binary(mp3) files to
Can I convert SVG image paths to Image map coordinates? Lets assume that I
Does SubSonic provide any mechanism to store image (converted in byte[] format)? Can someone
How can I convert the following Binary value to Bitmap image in ASP.NET C#
how can i convert eps image to jpg/png. any good application you can suggest.
How can I convert a Bitmap image to Drawable ?
How can I convert bytes of Image to an Image?
I need to convert image sequences(ie,png) to video file in iPhone. How i can
How can i convert an array of bitmaps into a brand new image of

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.