I am using a Dictionary
to store the frequency of colors in an image, where the key is the the color (as an int), and the value is the number of
In the 32 bit runtime, the maximum number of items you can have in a Dictionary
is in the neighborhood of 61.7 million. See my old article for more info.
If you're running in 32 bit mode, then your entire application plus whatever bits of ASP.NET and the underlying machinery is required all have to fit within the memory available to your process: normally 2 GB in the 32-bit runtime.
By the way, a really wacky way to solve your problem (but one I wouldn't recommend unless you're really hurting for memory), would be the following (assuming a 24-bit image):
LockBits
to get a pointer to the raw image dataint[count,2]
to hold the values and their occurrence counts.I wouldn't honestly suggest using this method. Just got a little laugh when I thought of it.