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
 IEImage.SaveImage failure (IEvolution)
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

cbc70037

USA
8 Posts

Posted - Apr 19 2021 :  21:20:39  Show Profile  Reply
The following code attempts to save an image as a JPEG to a stream, but executing that line causes an app termination (and no exception catch). The BMP attempt above that works fine. Will I need to do anything else with this image before attempting to write it into a stream?

Saving images to files works fine so I'll use that as a workaround, but since my target is a database, I hope to get saving and loading from streams to increase performance.

private void iem_AfterAcquireBitmap(object sender, HiComponents.IEvolution.IEAfterAcquireBitmapEventArgs e)
{
    IEImage img = iem.ImageList.GetImage(e.Index);
    img.Crop(0, 0, (int)(8.5 * 300) - 1, (int)(11 * 300) - 1);
            
    img.SaveImage($"{path}\\img{e.Index}.jpg");

    MemoryStream ms;
                
    // save as BMP -- works fine
    ms = new MemoryStream();
    try
    {
        img.SaveImage(ms, IEFileFormats.BMP);
        File.WriteAllBytes($"{path}\\img{e.Index}a.bmp", ms.ToArray());
    }
    catch (Exception ex)
    {

    }

    // save as JPG -- causes app termination on SaveImage line
    ms = new MemoryStream();
    try
    {
        img.SaveImage(ms, IEFileFormats.JPEG);
        File.WriteAllBytes($"{path}\\img{e.Index}a.jpg", ms.ToArray());
    }
    catch (Exception ex)  // never hit
    {

    }

    var ii = iem.ImageList.GetImageInfo(e.Index);
}

Thanks.


-C

xequte

38180 Posts

Posted - Apr 22 2021 :  06:16:43  Show Profile  Reply
Hi

We'll be releasing the next version of IEvolution very soon. In our tests that version should resolve this.

In the meantime please test the following:

img.SaveImage(@"test.jpg", IEFileFormats.JPEG);


If the bug is the same, the above code should crash or produce a zero-size file.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

cbc70037

USA
8 Posts

Posted - Apr 28 2021 :  13:20:22  Show Profile  Reply
I've confirmed that saving into files work OK and am using it as a workaround (please see my original post). Looking forward to the fix as I want to bypass the file system. Thanks.


-C
Go to Top of Page

xequte

38180 Posts

Posted - May 03 2021 :  21:32:52  Show Profile  Reply
Hi

Please download IEvolution 10 which should resolve this issue.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: