0

In order to store images in a SQL Server database, I am working with a naive table. The table's columns are: ImageID, X, Y, value.

Table sample data:

[1 1 1 255] %first image, pixel (1,1)
[1 1 2 100] %first image, pixel (1,2)
[1 2 1 100] %first image, pixel (2,1)
[1 2 2 0]
[2 1 1 100] %second image, pixel (1,1)
[2 1 2 10]

I choose this specific way for storing images for executing queries such as:

select count(value) 
from myTable 
where myTable.x = 10 and myTable.y = 15 and myTable.value > 10

The problem is that I am running out of storage - the table is getting too big. Do you have any suggestion for saving images more efficiently while maintaining the ability to executes queries like the mentioned above?

Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

3

I really feel that a database is the wrong way to handle this problem. I would have, perhaps, a database of image locations and a server side component that can read the images from some sort of local store (i.e. a directory) and run something like ImageMagik to determine if a particular pixel in each image is a particular color. This post might give you some ideas in that direction.

Community
  • 1
  • 1
stdunbar
  • 16,263
  • 11
  • 31
  • 53