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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:49:31+00:00 2026-05-14T14:49:31+00:00

I want to generate an image on server side. My image is stored in

  • 0

I want to generate an image on server side. My image is stored in a server database in blob format and I am able to convert it into string_image. Then how can I convert that string_image into actual .jpg or .png format?

Actually I am posting attachment as image on users facebook wall.
How to generate the image at server side in Java?
Is there any sample code to do it?

  • 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-14T14:49:32+00:00Added an answer on May 14, 2026 at 2:49 pm

    If you have the image in Blob format then you’re best bet it to use ImageIO and read the blob input stream directly.

    This will give you a java.awt.BufferedImage object which you can then render to any type of image using ImageIO. As an OutputStream, you can return that as a body/result from a HTTP GET controller.

    BufferedImage image = ImageIO.read( blob.getInputStream() );
    // Feel free to modify the image here using image.createGraphics()
    // add a water mark if you're feeling adventurous
    byte[] responseBody = toByteArray( image, "png" );
    
    ....    
    protected byte[] toByteArray(BufferedImage image, String type) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(image, type, baos);
        return baos.toByteArray();
    }
    

    I’m not intimately familiar with how facebook uses images. I think it differs depending on what you’re doing. For facebook applications, I think you’re still responsible for hosting the image, but facebook will act as a caching proxy and request the image just once, then serve it to all the client that need to see it. If it’s a user posted image, then I think facebook stores the image completely (obviously a user uploading a picture does not have it on another server usually).

    If you’re looking to just display the image "as is" in response to a a web request, then you can pipe the output of the Blob directly the client, although this keeps database connections open for a while, you might be better copying to a disk cache then serving to the client.

    I have to confess, I couldn’t find anything useful about what a stirng_image actually is? Perhaps you could clarify if this answer doesn’t meet your needs.

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

Sidebar

Related Questions

I want to be able to generate a different image (with watermark) when the
I want generate PDF File with an image. The image name from database and
I have an image that is uploaded and stored on server. I now want
Can anyone recommend a good server-side PDF generation tool that would work in a
In my application i want to upload the images to server. I am able
Hi how can I pass a client side (JS) value in server side (C#)?
Let's say I have a class of 30 students and want generate every possible
I want to generate a list of files where the name consists of ${filename}.${date}
I want to generate a random timestamp and add a random increment to it
I want to generate random integers between 0-9 (inclusive on both ends), but I

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.