473,473 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Loading big image. Please help.

Hello guys,

I hope you can help me. I have the following line in my code:

this.Butterfly = new Bitmap("c:\\butterfly.jpg");

which is pretty simple. The problem is that the size of butterfly.jpg
is 70 megs :) Of course, the program can't load it and i have the out
of memory exception.

My question is: how can I open that file? Please, give me some hints on
how to approach in this situation.

Thank you.

Nov 16 '05 #1
3 5056
Hi...

There are several possibilities.

1. Look into using a Memory Mapped File. You may need to use Interop (not
sure if the framework implements wrappers).
2. Chunk your reading by using a Binary Stream. Open the Binary Stream and
read N bytes per chunk. As long as you have memory, stich the chunks
together until you complete reading in the entire file.
3. Save the image at a lower resoution/depth. Many times, JPEG files do
not degrade as quickly as you might anticipate.

John Puopolo
"woth" <vi***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hello guys,

I hope you can help me. I have the following line in my code:

this.Butterfly = new Bitmap("c:\\butterfly.jpg");

which is pretty simple. The problem is that the size of butterfly.jpg
is 70 megs :) Of course, the program can't load it and i have the out
of memory exception.

My question is: how can I open that file? Please, give me some hints on
how to approach in this situation.

Thank you.

Nov 16 '05 #2
Firstly, what on earth do you need a 70MB jpeg of a butterfly for? ;)

Image Class size limit in GDI+ is 16Mb (2048x2048, 24bpp).

Let's say you want to display the image in a PictureBox on a WinForm. You
would actually need to create an algorithm to read chunks of the image into
a binary memory stream array. Then you would have to tile the pieces into a
series of Boxes keeping track of the alignment and order. You may end up
running out of system memory before its done!

In DirectX your texture size is limited by hardware. You can check your
D3DCaps to see what the max allowable is but I am sure you would still need
to chunkify and tile an image that large.

Remember, try microsoft.public.dotnet.framework.drawing for expertise on
gdi+...

ok,
aq

"woth" <vi***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hello guys,

I hope you can help me. I have the following line in my code:

this.Butterfly = new Bitmap("c:\\butterfly.jpg");

which is pretty simple. The problem is that the size of butterfly.jpg
is 70 megs :) Of course, the program can't load it and i have the out
of memory exception.

My question is: how can I open that file? Please, give me some hints on
how to approach in this situation.

Thank you.

Nov 16 '05 #3
It is a big trouble. I think the bitmap class loads your jpeg into a bitmap
format. Suppose your jpeg has a 1:8 compression ratio. The bitmap is 560MB!
Do you think you can store such a class in your memory?
Try declaring a picturebox and write:
pictureBox1.Image = Image.FromFile("c:\\butterfly.jpg");
I doubt if this will work. If not, you need to learn the jpeg file format
and open the file with StreamReader and read some data each time.
"woth" wrote:
Hello guys,

I hope you can help me. I have the following line in my code:

this.Butterfly = new Bitmap("c:\\butterfly.jpg");

which is pretty simple. The problem is that the size of butterfly.jpg
is 70 megs :) Of course, the program can't load it and i have the out
of memory exception.

My question is: how can I open that file? Please, give me some hints on
how to approach in this situation.

Thank you.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mekon | last post by:
I have never written a line of script in my life but I need some help with it now. I have this auto generated code which I want to modify if possible The script generates a strip of...
4
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just...
11
by: Detlef Hüttenbach | last post by:
Whereas loading tiffs and pngs from file into an Image WebControl work, the images aren't shown when loaded from streams: In a WebForm, the image's property "ImageUrl" is set to a handler, and...
3
by: Per Dunberg | last post by:
Hi all, I have to develop a "skinned" application and I have a problem with the graphics. When a form is loaded and displayed there's aways a flicker where all the controls are located on the...
5
by: toffee | last post by:
Hi all, I've seen a really cool effect which i would like to use on an intranet site. Am referring to the 'LOADING..' animation you see when switching pages. I've seen it somewhere on a website...
0
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
1
by: agatha.life | last post by:
I did a javascript for the loading of images (I didn't want to have the images loaded in "on loading" because they are too many). The website is for a model and if you look at the codeof pages (...
4
by: Sophy | last post by:
Hi folks, Now, I am facing problem with canceling image loading. I have tried: var img = new Image(); img.src = "path/to/the/image"; // and then I set the img.src to another source
1
by: krishnaraj suresh | last post by:
Hi , I am facing problem with Loading an Image in an aspx page It is taking long Time to Load But once the Image stored in Client-side Cash it is Loading Fast. Is there any way to Store the Image...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.