© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
55 replies
Tim

Getting Out of Memory Exception when loading in images

I get a system out of memory error after calling
Image.FromFile
Image.FromFile
in
GetTarget()
GetTarget()
. How should I fix this?

        public ImageManager()
        {
            _tiles = new List<Bitmap>();
            GetTarget();
            LoadAll();
        }

        private void GetTarget()
        {
            _target = (Bitmap)Image.FromFile(@"C:\Users\timo2\OneDrive\Desktop\The Grind\Personal Projects\PhotoMosaic\PhotoMosaicGenerator\downloaded_images\image_20.jpg");
        }
        public ImageManager()
        {
            _tiles = new List<Bitmap>();
            GetTarget();
            LoadAll();
        }

        private void GetTarget()
        {
            _target = (Bitmap)Image.FromFile(@"C:\Users\timo2\OneDrive\Desktop\The Grind\Personal Projects\PhotoMosaic\PhotoMosaicGenerator\downloaded_images\image_20.jpg");
        }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

❔ Out of memory exception
C#CC# / help
3y ago
Out of Memory Exception Help
C#CC# / help
3y ago
Application runs out of memory after compressing many images
C#CC# / help
6mo ago
Out of memory error
C#CC# / help
2y ago