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
 Error using GetImageToStream, please help :)
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Gubben

Norway
11 Posts

Posted - May 15 2016 :  10:24:25  Show Profile  Reply
This code gives an Access Violation and I'm not able to solve it.

If there is one image only, no error. If there are two or more images, error. But if I click inside the ImageEnMview before running this code, there is no error even with two or more images.

I'm stuck :)

var
ms : TMemorystream;

for i:=0 to ImageEnmView.imagecount-1 do
begin

try

ms:=TMemorystream.create;
ms.Position:=0;
ImageEnmView.MIO.Params[i].TIFF_Compression:=ioTIFF_JPEG;
ImageEnmView.MIO.Params[i].BitsPerSample:=2;
ImageEnmView.GetImageToStream(i,ms,iotiff);

....save to database...

finally
ms.Free;

end;
.....

Regards,
Ole

w2m

USA
1990 Posts

Posted - May 15 2016 :  11:04:47  Show Profile  Reply
I am not sure exactly what is occurring with your code, as you are not showing all the code. It could be caused by setting the stream position to 0 before calling GetImageToStream. Usually ms.Position is set to 0 only just before saving the stream to your database.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

Gubben

Norway
11 Posts

Posted - May 18 2016 :  13:56:48  Show Profile  Reply
I have given up the GetImageToStream, it's simply not working for me, gives an AV. I tried hard to solve the problem, but With no luck.

I used it for a long time, the AV came when updating the component library.

I now use the the SaveTostreamtiff, and everyting works great again.

Regards,
Ole
Go to Top of Page

xequte

38984 Posts

Posted - May 18 2016 :  17:26:09  Show Profile  Reply
Hi Ole

Is it only related to the database or is it a general issue in GetImageToStream().

If so can you give us a small demo that reproduces the error so we can investigate.

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