Batch processing bitmaps, running out of memory!

  • Thread starter Thread starter Mister S
  • Start date Start date
M

Mister S

Guest
I have created this (I am new to C#, please dont judge!), to check the size and resolutions of images.

private void check_image_file(string file_to_check)
{
float vresn;
float hresn;
int tilewidth;
int tileheight;
Bitmap tile = new Bitmap(file_to_check);

vresn = tile.VerticalResolution;
hresn = tile.VerticalResolution;
if (vresn != 254) { Console.WriteLine("Vertical res for file " + file_to_check + " not 254"); }
if (hresn != 254) { Console.WriteLine("Horizontal res for file " + file_to_check + " not 254"); }

tilewidth = tile.Width;
tileheight = tile.Height;
if (tilewidth != 4000) { Console.WriteLine("Width for file " + file_to_check + " not 4000"); }
if (tileheight != 4000) { Console.WriteLine("Height for file " + file_to_check + " not 4000"); }
I am calling this over 2000 times but when I do, I run out of memory! The image files are quite big so suspect it is not releasing the memory used for each file before starting again for the next one?? Maybe not but any help would be much appreciated

Continue reading...
 

Similar threads

L
Replies
0
Views
94
LuisIngles
L
B
Replies
0
Views
284
btb900
B
E
Replies
0
Views
86
elfenliedtopfan55
E
E
Replies
0
Views
121
elfenliedtopfan55
E
Back
Top