picture.loadfromfile problem

Please discuss general Delphi programming topics here.

picture.loadfromfile problem

Postby martincg » April 24th, 2006, 11:48 pm

I use picture.loadfromfile to load an image.

I then save it somewhere using picture.savetofile.

Later, I might need to load the picture again from the last saved version, maybe when the application runs another time and this is where I have a problem. When the file is large (don't know what size is importatnt) I always get an error that the bmp is invalid when I try to load the saved version.
With smaller file, say 200K I have no problem. I appears that with large files savetofile causes an error.

Anyone understand this? Or more importantly, know how to solve it?
martincg
Active Member
Active Member
 
Posts: 10
Joined: April 22nd, 2006, 11:13 am

Postby Kambiz » April 25th, 2006, 11:04 am

I checked it out with a 1600x1200 bitmap using Delphi 6, all was OK.

Try to set Bitmap.HandleType to bmDIB, it may solve the problem. By the way, the Width and Height of the bitmap should be known before setting the HandleType property (e.g. set HandleType after loading the image).
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2424
Joined: March 7th, 2003, 7:10 pm

savetofile problem

Postby martincg » April 25th, 2006, 11:59 am

Thanks for the suggestion Kambiz.
I have will add your suggestion to my program and try it
martincg
Active Member
Active Member
 
Posts: 10
Joined: April 22nd, 2006, 11:13 am


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron