[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Working with large images in VB.NET

Posted on 2004-08-20
Medium Priority
Last Modified: 2010-05-18
Hi im working on an application that is supposed to handle large images, now i seem to have some trouble with the bitmap object, seems it can only handle images that are like 10000px,10000px i dont know the exact number but this can be alittle too small sometimes...

but when i open smaller images ( < 10000x10000 but still really large) i get a "Out of memory" exception even tho the taskmanager reports just 170Mb memory used out of one GB of ram....

is it possible to break that limit and load say 3 times that amount of memory in bitmap objects so i can work with the three images at the same time...

well, its actually 4 since i create another graphics object and clone parts of the three input images to the output graphics object...

has anyone experience with working with large image files?

the reason that i need such large images is because they are supposed to be printed later on very large paper with very good quality... like 1Meter height and variable width...

Question by:JohnnyGr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Expert Comment

ID: 11857941
JohnnyGr: Understand that an image (lets say 10x10 pixel) but then twice so big (that makes 20x20) needs about 4 times more memory of uncompressed image data.

What program do you use?

Author Comment

ID: 11858254
im using my own program im trying to make...

but still... the application just uses 170 meggs of memory... and i have about 700mb free, plus swap so there should be more than enough memory to work with.. but i still get "Out Of Memory" exceptions....

Expert Comment

ID: 11859094
Okay... I understand that you use only 170 Mb. But I could be that for you NEXT operation you exceed the maximum mem, the program could predict you would exceed this amount and give you the error (so you would not see any change of mem usage in taskmanager)

My next guess (since nobody else helps you):

Mostly you get strange things like this if you not do clean/close used objects/var. Try to clear the graphics objects if you can... after/before you use it. Also when you close an application. Something like this: graphics_object.clear and resize its pixels down to a minimum.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 14

Expert Comment

ID: 11866662
I have some experience with images in the hundreds of megabyte range using VB.Net.  One thing you will absolutely want to make sure you do is make sure you call the DISPOSE method on ALL graphics objects you create with the New keyword.  This includes Graphics, Brush, Pen objects.   DON'T rely on the objects to be released when they go out of scope.   If that doesn't have too much of an effect, try putting a call to GC.Collect to force the Garbage collector to run which will release any resources that are tagged for disposal.  Dealing with images this large requires very strict programming discipline to make sure you clean up after yourself as soon as you are done with the objects.   Basically, if you create an object with New and you are done with it, if it has a Dispose method...call it!  (Use intellisense (or the object browser) to see if it does).



Author Comment

ID: 11867644
Well i seem to have things going my way now...
I did as Daniellus83 and ptakja suggested and made sure i cleaned up everything ive been using... setting objects to disposed didnt work always tho.... but setting them to Nothing did. wich is kindof the same...

But it still seems that the bitmap object only can handle a image thats something like
10000px X 10000px and im trying to work with some really high resolution images for some advertisment, that are supposed to be printed on really big paper...

I dont really know much about the images more than i was asked if i could fix this...

Is there some way i can boost the number of pixels a bitmap object can hold?

Accepted Solution

Daniellus83 earned 750 total points
ID: 11868680
Dear JohnnyGr; You might waana read this 'interesting' topic:


It seems to be like yours.

  "...GDI run out of its allocated kernel memory (the still uncertain X percent of
                       my 512 megabytes of ram) and crash with the said internal windows message..."

Author Comment

ID: 12101765
Whops, looks like i forgot all about this, well this problem ended up with the project being abandoned because theres no way you can create larger images than 10000x10000 something, no matter how hard you try, and that caused the out of memory error, wich it throws for all kinds of reasons...... and the images i was supposed to open was alot larger than that...
and with higher resolution...


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question