I have tried .tif and .tiff images to load in a custom controls picturebox, and I'm looping it through many images (about 50 or so) and I keep get the out of memory exception error. I have tried to use .tif or .tiff for it because I have heard, that .tif is smaller than .tiff. Also, the .png format does not help at all as well. I can still change my formats but I need to keep my alpha channel.
This is a part of my code:
foreach (CategoryDTO category in Categories)
{
foreach(The_Forest_App.JsonObjects.Item item in category.Items)
{
string filepath = "res/img/items/" + Language + "/" + item.Name.Replace(" ", string.Empty).ToLower() + ".png";
The_Forest_App.Item ItemListed = new The_Forest_App.Item
{
ItemName = item.Name,
ItemImage = Image.FromFile(filepath),
Parent = itemsFlowLayoutPanel
};
}
}