Is it possible to load images from web asynchronously?

Now with OF007, it is possible to load online image, but it seems to load images syncrhonously, which freezes the application during loading. Is there a method for asynchronous loading images from the web?

the easiest way is to use the ofxThreadedImageLoader addon

Thanks arturo. It works for asynchronous loading, but is there way that tells me when the image is loaded completely? I want to know the the width and height of the image, so I must know when the image is completed loaded. If I call ofimage.width too early, then it returns 0.

actually i can check it in the loop, and when the width is not 0 I fire a loadcomplete event. are there any other methods?

i haven’t used the addon that much, but uit doesn’t seem so. you could add the event directly in the addon, it actually makes lots of sense to have it there so you can know when an image has been loaded

the ‘correct’ way to check whether an image is loaded is to check whether it’s bigger than 0x0.

i was talking with roxlu (who made ofxThreadedImageLoader) about having an event system, but that was at the end of ofdev-con and it didn’t happen.

one other way of checking would be to look at the size of the deques inside ofxThreadedImageLoader, and if they’re all empty then your images are all ready.