Конференция "KOL" » Error with CxKOLTiffJpg
 
  • Jon © (21.02.08 07:02) [0]
    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?
  • Сидор (21.02.08 12:52) [1]
    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.

  • Jon © (21.02.08 16:06) [2]
    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".
  • Jon © (21.02.08 16:44) [3]
    I have the same problem when I try to compile the demo (KOLJpegDemo_.zip) included with CxKOLTiffJpg.zip - runtime error at LoadFromFile
  • Vladimir Kladov © (21.02.08 20:27) [4]
    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 © (21.02.08 21:51) [5]
    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.

  • Jon © (21.02.08 22:10) [6]
    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.

  • Vladimir Kladov © (22.02.08 15:14) [7]
    ADDITIONAL_USES
  • Jon! © (22.02.08 16:28) [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 © (23.02.08 11:58) [9]
    TESTING not needed, only ADDITIONAL_USES.
    GetStartDir may be solve your problem.
  • Jon © (24.02.08 01:58) [10]
    I removed TESTING.
    Added and checked GetStartDir (MsgOk...).
    Tried on different machine too.
    Still same problem - error at LoadFromFile/Stream.
    Any other suggestions?
  • Jon © (24.02.08 01:59) [11]
    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 © (24.02.08 11:27) [12]
    I suppose that just file was not found, so full path must be specified.
  • Jon © (24.02.08 15:49) [13]
    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 © (24.02.08 17:42) [14]
    may be image is not jpeg? Is it opening with JpegObj?
  • Jon © (24.02.08 19:11) [15]
    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.
 
Конференция "KOL" » Error with CxKOLTiffJpg
Есть новые Нет новых   [134431   +15][b:0][p:0.002]