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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEImage.SaveImage failure (IEvolution)

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
cbc70037 Posted - Apr 19 2021 : 21:20:39
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
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 03 2021 : 21:32:52
Hi

Please download IEvolution 10 which should resolve this issue.

Nigel
Xequte Software
www.imageen.com
cbc70037 Posted - Apr 28 2021 : 13:20:22
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
xequte Posted - Apr 22 2021 : 06:16:43
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