This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Image Manipulation in Swing AWT  RSS feed

 
Saakshi Dikshit
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir, I'am new to Swing Programming. I have to create an application where an image is displayed on one Label. The same image has to be split in parts and stored in database pert wise. Later the user has to retrieve the entire image by viewing a small part of the image. I have already displayed the full image on the Label, now i don't know how to split the image and store it part wise in the database. Kindly help me out with this problem. It's urgent since I have to submit my project within a week.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. Assuming you have a BufferedImage, you can use its getRGB method to return rectangular subsections of the image. You could then store the data in these arrays in some way in the DB, or create a new BufferedImage object from them and store that. The javax.imageio.ImageIO class would be helpful in the latter case.

If you want to split the image into non-rectangular parts it becomes more complicated.
 
Saakshi Dikshit
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir could you please provide me with code to do the same.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have such code handy. Besides, this sounds like a homework assignment that you should be doing in order to learn something.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!