Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Error with CxKOLTiffJpg


Jon ©   (2008-02-21 07:02:00) 

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?


Jon   (2008-02-24 19:11:00) [1]

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.


Vladimir Kladov   (2008-02-24 17:42:00) [2]

may be image is not jpeg? Is it opening with JpegObj?


Jon   (2008-02-24 15:49:00) [3]

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 ), {require_imaged=}Integer( TRUE ) );
KOLJpeg.pas line 1611.


Vladimir Kladov   (2008-02-24 11:27:00) [4]

I suppose that just file was not found, so full path must be specified.


Jon   (2008-02-24 01:59:00) [5]

I removed TESTING.
Added and checked GetStartDir (MsgOk...).
Tried on different machine too.
Still same problem - error at LoadFromFile/Stream.
Any other suggestions?


Jon   (2008-02-24 01:58:00) [6]

I removed TESTING.
Added and checked GetStartDir (MsgOk...).
Tried on different machine too.
Still same problem - error at LoadFromFile/Stream.
Any other suggestions?


Vladimir Kladov   (2008-02-23 11:58:00) [7]

TESTING not needed, only ADDITIONAL_USES.
GetStartDir may be solve your problem.


Jon!   (2008-02-22 16:28:00) [8]

Here too. My complete list: KOL_MCK;ADDITIONAL_USES;TESTING;

I shall try installing Delphi and KOL on another machine and check results...


Vladimir Kladov   (2008-02-22 15:14:00) [9]

ADDITIONAL_USES


Jon   (2008-02-21 22:10:00) [10]

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);  // <--- error here
 S.Free;
 J.DIBNeeded;
 J.Bitmap.SaveToFile('test.jpg');
 J.Free;
end.


Jon   (2008-02-21 21:51:00) [11]

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);  // <--- error here
 S.Free;
 J.SaveToFile('test.jpg');
 J.Free;
end.


Vladimir Kladov   (2008-02-21 20:27:00) [12]

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.


Jon   (2008-02-21 16:44:00) [13]

I have the same problem when I try to compile the demo (KOLJpegDemo_.zip) included with CxKOLTiffJpg.zip - runtime error at LoadFromFile


Jon   (2008-02-21 16:06:00) [14]

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".


Сидор   (2008-02-21 12:52:00) [15]

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.


Наверх

Титульная страница Поиск, карта сайта Написать письмо