• Post Reply Bookmark Topic Watch Topic
  • New Topic

Grabbing Image Pixels through Pixel grabber & saving it to Database  RSS feed

 
Manoj Tyagi
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have to give an applet where user can make colored images. Now what is my problem is - i have to save pixels of this image in DataBase (MS - SQLServer 2000) so that later on I can retrieve these pixels & show the image to user (may be on further requests).
My image sizes may range from 72*14 to 112*56 or may other range. Now if take the example of the smallest image that is 72*14, it amounts to the 1008 pixels. Now when i grab these pixels through Pixel Grabber, each integer value is almost 8 to 10 integer (means like 987766678, 98877666 or something like this). I can reduce this length by converting these integers to hex but still it will be 5 to 6 digits like (FFFFFF, FFAAEE like that).
Means 1008 pixels will take almost the length of 5000 to 6000 (if i take this in varchar or text field of SQL Server). I am using Java in the front end (AWT package).
How should i save this information in DB. Can i save the complete java array in SQL Server & retrieve later on. How much burden it will create on DB. Whether this will reduce the retrieval later on. These are the few points about which i am confused a lot.
Can any one help me out & suggest the strategy for the same.
For black & white images that is not an issue as in this case all can be taken as 0's & 1's & hence length is reduced a lot. But for colored images it seems to be a problem.
Waiting for any suggetion / help........
Manoj Tyagi

 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are just going to display the image to the user later why not just generate a jpeg and save the filename in the database? I'm not sure how SQLServer stores things, but if you just needed to display (not re-edit) the image, you would be better off converting the image to a JPEG and saving it as some kind of binary data type in the database than as pixel values, because JPEG is compressed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!