• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

display an image from an inputsource

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
i have to display an image file(in the JFrame or panel),which comes through an inputstream from the database and not from the local drive.how to do it?.
i tried to write the contents of the inputstream to a file and drawImage(file) and it writes to the JFrame.but i just want to know,is there anyway i can directly draw the image from the inputstream.
thanks in advance,
lavanya
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Determine image size and create a byte[] to hold it from the stream. Once loaded you can directly create the image by using either creating a new ImageIcon using one of the constructors that take a byte[] or using Toolkit.createImage(byte[] imageData)
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, how does one then handle an Image with more than Integer.MAX_VALUE bytes?
 
lavanya subramanian
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dale,
thanks,it's working

lavanya
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ummm... that would mean the Image is around 20 Gigs in size.... I think you would have massive performance problems when dealing with images of this size anyway... I'd think you would split this gigantic image into several smaller images and load only the parts you need...

-Nate
 
Can you hear that? That's my theme music. I don't know where it comes from. Check under this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic