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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:48:37+00:00 2026-06-12T23:48:37+00:00

I have a problem and I hope that you can help me. I would

  • 0

I have a problem and I hope that you can help me. I would appreciate any help from anyone. The problem is the following.

I have a camera that has an http service, and I am communicating with the camera using the http. So the problem is that I send http request and I have back an http response in which I have a binary jpeg data. But I do not know how to convert that data into picture.

So my question is how can I convert that binary data into picture with java?

This is one example

http request:

GET (url to picture) 

http response:

binary jpeg data

I thank to all of you in forward for all of your help.

URL url = new URL("http://10.10.1.154" + GETIMAGESCR());
        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
        String inputLine;
       // while ((inputLine = in.readLine()) != null){
                // inputLine = in.readLine();
                 File file = new File("D:\\alphas\\proba.bin");
                 boolean postoi = file.createNewFile();
                 FileWriter fstream = new FileWriter("D:\\alphas\\proba.bin");
                 BufferedWriter out = new BufferedWriter(fstream);
                 while ((inputLine = in.readLine()) != null){
                 out.write(in.readLine());
                // out.close();
               //  System.out.println("File created successfully.");
            System.out.println(inputLine);
            }
            System.out.println("File created successfully.");
            out.close();
            in.close();

With this code I am getting the binary JPEG data, and I menage to save the data in a file. So the question is now how to convert this data into picture, or how to create the picture?
By the way I do not need to save the file that I get, if you have a way to create the picture directly it would be the best way

retrieve single image via its url in java

  • 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-06-12T23:48:38+00:00Added an answer on June 12, 2026 at 11:48 pm

    you just need to write byte data of image in response and set the proper content type, It will serve image from servlet

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

Sidebar

Related Questions

I have a problem with the esmtp application that I really hope you help
I have a problem with a UIView, hope you can help me. I have
this problem has been doing my head in and I hope you can help!
I have a problem with docking. Here is the thing. I hope I can
I have a very weird problem.. I really do hope someone has an answer
hope you can help. I am recording audio from a microphone and streaming it
I'm having a really frustrating problem I hope someone can help me with. Here
I would really appreciate some help based on the following image: Furthermore, I am
I hope that someone can help me with this. As you know when an
I hope you can help me here... I have a conflict with the decimal

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.