Home
Features
Demos
Store
Forum
Support
ImageEn Forum
Profile
Join
Active Topics
Forum FAQ
Search
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
Image loading with TImageEn AsynchMode
New Topic
Reply to Topic
Author
Topic
harry113
3 Posts
Posted - Sep 16 2015 : 10:56:40
Hi,
Can I use TImageEn AsychMode to load 2 or more different images different TIEBitmaps in parallel?
Something like this example from the help file but for loading?
// multithread saving
Var
Bmp: TIEBitmap;
Io: TImageEnIO;
Begin
Bmp := TIEBitmap.Create;
Io := TImageEnIO.CreateFromBitmap(bmp);
Io.LoadFromFile('C:\input.bmp');
Io.AsyncMode := True; // this makes a thread foreach input/output task
Io.SaveToFile('D:\i1.jpg'); // thread-1
Io.SaveToFile('D:\i2.jpg'); // thread-2
Io.SaveToFile('D:\i3.jpg'); // thread-3
// waits all threads finish
Io.WaitThreads();
...
End;
xequte
38517 Posts
Posted - Sep 17 2015 : 01:16:23
Hi
A TIEBitmap can only store one image, so if you load two images simultaneosly, the second image would replace the first one. Why not just create two TImageEnIO's?
Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
harry113
3 Posts
Posted - Sep 17 2015 : 03:34:42
Hi,
I tried to do it that way,
...
bm1:= TIEBitmap.create;
bm2:= TIEBitmap.create;
IO1:= TImageEnIO.Create(nil);
IO2:= TImageEnIO.Create(nil);
IO1.AsyncMode:= True;
IO2.AsyncMode:= True;
IO1.AttachedIEBitmap:= bm1;
IO2.AttachedIEBitmap:= bm2;
IO1.LoadFromFile('File1.jpg');
IO2.LoadFromFile('File2.jpg');
IO1.WaitThreads;
IO2.WaitThreads;
FreeAndNil(IO1);
FreeAndNil(IO2);
...
Ofcourse after loading I need bm1 und bm2 for further work.
In my example I used this schema to load up to 8 files in parallel with mixed results - WaitThreads crashed, empty bm1, access violations etc...
Is there some sample Code for loading files in parallel in Asynch Mode?
Best Regards,
Harry
xequte
38517 Posts
Posted - Sep 17 2015 : 21:23:11
Hi Harry
That code should work fine. I just tested it to be sure. If you are seeing a crash please post a full example.
Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Topic
New Topic
Reply to Topic
Jump To:
Select Forum
ImageEn Library for Delphi, C++ and .Net
ImageEn and IEvolution Support Forum
--------------------
Home
Active Topics
Frequently Asked Questions
Member Information
Search Page