Re: Out of system resources
- From: Bart <broersma.juda_ANTISPAM_@xxxxxxxxxx>
- Date: Fri, 17 Nov 2006 18:46:44 +0100
Op Thu, 16 Nov 2006 23:51:21 +0100 schreef "Tom de Neef"
<tdeneef@xxxxxxxx>:
procedure CopyImageToSize(sourceFile,destinationFile : string; width,height
: integer);
// Read sourceFile and extract to bitmap in predetermined scale.
// Export to jpg.
var
ext : string;
bitmap : Tbitmap;
JPGimage : TjpegImage;
rect : Trect;
begin
bitmap:=Tbitmap.Create;
try
rect.Left:=0;
rect.Right:=width;
rect.Top:=0;
rect.Bottom:=height;
ext:=Uppercase(extractFileExt(sourceFile));
if (ext='.JPG') OR (ext='.JPEG') OR (ext='.BMP')
then CopyImageToBitmap(sourceFile,bitmap,rect)
else ; // skipped for this post
Just a wild guess here.
If you exit this procedure when extension is not jpg, jpeg or bmp,
then bitmap.free will not be called, so you have a memory leak???
JPGimage:=TjpegImage.Create;
try
JPGimage.Assign(bitmap);
JPGimage.CompressionQuality:=60;
JPGimage.SaveToFile(destinationFile); // <------- if ERROR, then it
will happen here
except
end;
JPGimage.free
finally
bitmap.free
end;
end;
I've never worked with threads, so if the problem lies there, I won't
be able to give any reasonable answers...
Bart
--
Bart Broersma
broersma.juda_ANTISPAM_@xxxxxxxxxx
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
.
- Follow-Ups:
- Re: Out of system resources
- From: Tom de Neef
- Re: Out of system resources
- References:
- Out of system resources
- From: Tom de Neef
- Re: Out of system resources
- From: Bjørge
- Re: Out of system resources
- From: Tom de Neef
- Out of system resources
- Prev by Date: Re: Learning recursion with hailstone seqence
- Next by Date: Re: Learning recursion with hailstone seqence
- Previous by thread: Re: Out of system resources
- Next by thread: Re: Out of system resources
- Index(es):
Relevant Pages
|