ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Jpeg2000 saving to stream problem
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 15 2017 :  12:59:27  Show Profile  Reply
I am using this code to save images to an Absolute Database table.
procedure TfrmMain.btnWriteClick(Sender: TObject);
var
  BlobStream: TABSBlobStream;
  MemStream: TMemoryStream;
begin
  MemStream := TMemoryStream.Create;
  try
    ImageEnView1.IO.SaveToStreamJP2(MemStream); //  Program freezes at this line
    //ImageEnView1.IO.SaveToStreamJ2K(MemStream);  // Program freezes at this line
    //ImageEnView1.IO.SaveToStreamJpeg(MemStream);  //  Works properly

    //ImageEnView1.IO.SaveToStream(MemStream, ioJP2); //  Program freezes at this line
    //ImageEnView1.IO.SaveToStream(MemStream, ioJ2K); // Program freezes at this line
    //ImageEnView1.IO.SaveToStream(MemStream, ioJPEG);  //  Works properly
    MemStream.Position := 0;
    //  Now save to blobstream
    with tblMain do
      begin
        Insert;
        BlobStream := TABSBLOBStream(CreateBlobStream(FieldByName('Image'), bmWrite));
        try
          MemStream.SaveToStream(BlobStream);
        finally
          Blobstream.Free;
        end;
        Post;
      end;
  finally
    MemStream.Free;
  end;

end;
All SaveToStream methods for Jpeg2000 work when saving small images, but on larger images (eg from my Nikon 3200 camera, 6016x4000 pixels), the program freezes at the point when SaveToStream is called for all JPEG2000 methods.

SaveToStream Jpeg works without any problems.

Is there a bug in the SaveToStream for Jpeg2000 methods, or am I doing something wrong?

(ImageEn 7.0.0, Delphi 10.2 Tokyo, target Win64)

xequte

38180 Posts

Posted - Jul 16 2017 :  19:24:33  Show Profile  Reply
Hi Patrick

Your code looks correct, but I cannot get it to freeze at the point you mention. Are you sure you have copied the latest version of ielib64.dll to your exe folder? Does it work if you use a Win32 target?

You could also try stepping into the ImageEn code to see where it fails (i.e. by adding the ImageEn source code folder to your Library path).





Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 17 2017 :  16:28:20  Show Profile  Reply
Apologies, I wasn't using the latest ielib64.dll.

It is now works, although is very slow.
Go to Top of Page

xequte

38180 Posts

Posted - Jul 18 2017 :  04:16:20  Show Profile  Reply
Hi Patrick

Slower than 32bit?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 18 2017 :  18:07:43  Show Profile  Reply
Hi Nigel

No, 32 bit is slower still.

It's not important. I was just experimenting as I understand that you can use higher compression with JP2000 than JPEG for the same quality but if there's a speed hit I'm happy to use JPEG instead.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: