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
 TImageEN - Thread safe usage?

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
cpstevenc Posted - Jan 10 2025 : 18:47:33
I've been using TImageEN in a thread for 10 years now for one process.

Simple process to load jpeg, check width/height, and rescale it if needed to a new file, tag new EXIF stuff on the jpeg.

It has been working fine for years, but now it seems not so much.

I am on Delphi 11.3 and ImageEN 11.4.0 for now.

In my thread, just the creation of the TImageEN will sometimes create an AV error.

I get this to happen in a small stand alone program, that all it does it Create / Load / Free. Randomly happens, but will happen in my tests.

If I wrap just the creation of the TImageEN in a tthread.Synchronize , it passes all every time.

So this probably tells me, i've been lucky for years on doing it the wrong way.

So my question is, what is the best way for threads?

I need to load Image.
I need to check width/height.
I need to rescale and output a new file.
I need to also tag EXIF data.





3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 11 2025 : 15:07:16
Hi

A TImageEnView (TImageEn is a legacy component, and internally they are now just a TImageEnView) should be safe to use in a thread if it is used non-visually, so I'd need to see your code to see where the issue is, but you are better to use a TIEBitmap anyway.



Nigel
Xequte Software
www.imageen.com
cpstevenc Posted - Jan 10 2025 : 21:58:54
Very nice... Thanks for the help. That seems to work just fine now!

This code I wrote so long ago and doing it wrong but it worked well all these years.

Which I was lucky I guess. I haven't had to really think about this until it came up.






xequte Posted - Jan 10 2025 : 21:25:52
Hi

For the purposes you mention, there is no reason to use a visual control. You should just use a TIEBitmap.

> I need to load Image.

TIEBitmap.LoadFromFile()

> I need to check width/height

TIEBitmap.Width/Height

> I need to rescale and output a new file

TIEBitmap.Resample()
TIEBitmap.SaveToFile()


> I need to also tag EXIF data

TIEBitmap.Params.EXIF_* := ...;

Note: Ensure you have set TIEBitmap.ParamsEnabled := True before loading


Please see:

http://www.imageen.com/help/TIEBitmap.html

Nigel
Xequte Software
www.imageen.com