I have a folder with height quantity of geolocated file, I want to make a KML with the placemark.
No problem for the XML(KML) document, but the image are big and i want create a thumb(1/10) and small image (1/4) in separated folder.
The image are 4000x3000 allround 5mb, for little quantity not have problem but when the folder containg more of 35 image (in debug) i have the problem.
I have try with disposable object used with Using, GC.collect
to only image elaboration, but nothing.
I have folder to elaborate with 1400 image or more...is possible make to work this application with it?
public static class MyClass_img
{
public static void ResizeImage(Image image, int width, int height, string pathImage)
{
using (var destImage = new Bitmap(width, height))
{
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using (var graphics = Graphics.FromImage(destImage))
{
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
using (var wrapMode = new ImageAttributes())
{
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
var destRect = new Rectangle(0, 0, width, height);
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
}
}
destImage.Save(pathImage);
}
GC.Collect();
}
public static string imageReduce(Image img, string path, int percentValue, string extension, string folder)
{
var dirName = new DirectoryInfo(path).Parent.Name;
string pathImg = folder + dirName + "_" + Path.GetFileNameWithoutExtension(path) + extension;
AprItalia_img.ResizeImage(img, img.Width / percentValue, img.Height / percentValue, pathImg);
return pathImg;
}
}