-
I have a problem with CxKOLTiffJpg. Code stripped for ease of testing: program Test;
uses
KOL, KOLJpeg;
begin
Applet := NewForm(nil,'Test JPEG');
with NewJpeg^ do
begin
LoadFromFile('Test.jpg');
end;
Run(Applet);
end. Above code produces a runtime error. Test.jpg exists and is a valid jpg image, Any advice?
-
Why can't you write simply: program Test;
uses
KOL, KOLJpeg;
var Jpeg: TKOLJpeg;
begin
Applet := NewForm(nil,'Test JPEG');
Jpeg:=NewKOLJpeg;
Jpeg.LoadFromFile('Test.jpg');
Run(Applet);
end.
-
The code is the same, just a different way of writing it. Same result: program Test;
uses
KOL, KOLJpeg;
var
JPEG: PKOLJpeg;
begin
Applet := NewForm(nil,'Test JPEG');
JPEG := NewJpeg;
JPEG.LoadFromFile('Test.jpg');
Run(Applet);
end. When I try to do anything with the object there is the "Runtime Error".
-
I have the same problem when I try to compile the demo (KOLJpegDemo_.zip) included with CxKOLTiffJpg.zip - runtime error at LoadFromFile
-
program Cx;
uses
KOL, KOLJpeg, err;
var J: PKOLJpeg;
begin
J := NewJpeg( );
J.LoadFromFile( GetStartDir+'001.jpg' );
J.DIBNeeded;
J.Bitmap.SaveToFile( GetStartDir+'001.bmp' );
J.Free;
end.
Just tested, all works properly.
-
Tried your code but still does not work here. Do you have any compiler options set? I have to use conditional define 'TESTING' for compile to work. Problem is always on LoadFromFile. More specifically it fails with LoadFromStream. As tested here: program Test;
uses
KOL, KOLJpeg, err;
var
J: PKOLJpeg;
B: PBitmap;
S: PStream;
begin
S := NewMemoryStream;
B := NewBitmap(100,100);
B.SaveToStream(S);
B.Free;
J := NewJpeg;
J.LoadFromStream(S); S.Free;
J.SaveToFile('test.jpg');
J.Free;
end.
-
Sorry, I posted wrong code: program Test;
uses
KOL, KOLJpeg, err;
var
J: PKOLJpeg;
S: PStream;
begin
S := NewReadFileStream('test.jpg');
J := NewJpeg;
J.LoadFromStream(S); S.Free;
J.DIBNeeded;
J.Bitmap.SaveToFile('test.jpg');
J.Free;
end.
-
ADDITIONAL_USES
-
Here too. My complete list: KOL_MCK;ADDITIONAL_USES;TESTING;
I shall try installing Delphi and KOL on another machine and check results...
-
TESTING not needed, only ADDITIONAL_USES. GetStartDir may be solve your problem.
-
I removed TESTING. Added and checked GetStartDir (MsgOk...). Tried on different machine too. Still same problem - error at LoadFromFile/Stream. Any other suggestions?
-
I removed TESTING. Added and checked GetStartDir (MsgOk...). Tried on different machine too. Still same problem - error at LoadFromFile/Stream. Any other suggestions?
-
I suppose that just file was not found, so full path must be specified.
-
Full path is specified but error occurs. If file is not found, no error is produced. I trace error into assembly area but do not understand it. Line where error occurs is: j__jpeg_read_header( Integer( @ cinfo ), Integer( TRUE ) ); KOLJpeg.pas line 1611.
-
may be image is not jpeg? Is it opening with JpegObj?
-
Yes, I have a small project using JpegObg which works fine. I am attempting to transfer to CxKOLTiffJpg because of large images. All my tests are with small simple jpeg images which work. Sorry if I am being a nuisance.
|