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

Home Posts Topics Members FAQ

how can i load jpg from file

Hello
I finally managed to save Bitmap that reprezented my pictureBox to jpg
file, but now how can i load from that file to Bitmap again ?
Bitmap does not have any Load or Open method (like Save...).
Thanx
Michal

Nov 16 '05 #1
3 21336
APG
us**@domain.invalid wrote:
Hello
I finally managed to save Bitmap that reprezented my pictureBox to jpg
file, but now how can i load from that file to Bitmap again ?
Bitmap does not have any Load or Open method (like Save...).
Thanx
Michal

Hi,

One option is using the constructor to load the file. The Bitmap class
constructor has many overloads and one of it accepts the file name as
parameter.

HTH,
APG
Nov 16 '05 #2
Hi Michal,
Hello
I finally managed to save Bitmap that reprezented my pictureBox to jpg
file, but now how can i load from that file to Bitmap again ?
Bitmap does not have any Load or Open method (like Save...).
Thanx
Michal


To load any image you can call:
Image.FromFile(...)

If image if a JPEG then You can cast it to Bitmap.
e.g. Bitmap myJpeg=(Bitmap) Image.FromFile("myJpegPath");

Regards

Marcin
Nov 16 '05 #3
> Hello
I finally managed to save Bitmap that reprezented my pictureBox to jpg
file, but now how can i load from that file to Bitmap again ?
Bitmap does not have any Load or Open method (like Save...).

Something like this, this prevents locking the file too long.

public void Load(string asFile) {
//--- Because Image keeps th file locked untill the garbage collector
releases it, we have
// to make it released as soon a possible using this trick.
Stream BitmapStream =
System.IO.File.Open(asFile,System.IO.FileMode.Open );
Image imgPhoto = Image.FromStream(BitmapStream);
BitmapStream.Close();

//--- Now the file is beeing released continue using the contents.
mBitmap=new Bitmap(imgPhoto);
}
Nov 16 '05 #4

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

Similar topics

1
by: Ray in HK | last post by:
What are the differences between LOAD DATA INFILE and LOAD DATA LOCAL INFILE ? I found some web hosting company do not allow using LOAD DATA INFILE but allow LOAD DATA LOCAL INFILE. The reason...
5
by: kk | last post by:
Hello, I am using the udb 8.1 task scheduler to schedule a load. Is there any way to also schedule an OS command (win32) to delete the file after the load? I have a python script that will do...
0
by: Simon | last post by:
Hi I try to open a CR report file located on the network path from a web form developed with vs2003 and CR for Visual Studio, but the Load method of ReportDocument object always return error. ...
3
by: nsh | last post by:
mailing.database.mysql, comp.lang.php subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING! version info: my isp is running my web page on a linux box with php ver. 4.4.1 according to...
4
by: andrewcw | last post by:
I am moving some code forward from .NET 1.1. I was able to load the XSL file and perform the transform. The MSDN documentation looks like it should be easy. But I get a compile error. Ideas ?...
0
by: giovanni gherdovich | last post by:
Hello, first of all: Is this the right place to ask plastek-related questions? I'm trying to make plastex work on my Ubuntu Dapper Drake. For LaTeX, I have the all-in-one package tetex.
2
by: contractsup | last post by:
Environment: $ uname -a AIX <withheld2 5 000100614C00 $ db2level DB21085I Instance "<withheld>" uses "32" bits and DB2 code release "SQL08024" with level identifier "03050106"....
10
by: lamxing | last post by:
Dear all, I've spent a long time to try to get the xmldocument.load method to handle UTF-8 characters, but no luck. Every time it loads a document contains european characters (such as the...
2
by: David Thielen | last post by:
So we have moved our app from .NET version 2.X in IIS6 to a Windows 2008 Server running IIS7. We have copied all files to the Windwardreports\apps directory and that apps directory has been...
13
by: rdudejr | last post by:
Hi all, I hardly ever make a post unless I am having a very purplexing issue, so this one should be good... I am trying to do a load against a database on an AIX server into a DB2 v9.1...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.