P
pedrito
I've got an app that downloads images off the internet using anywhere from
1-20 threads concurrently (though generally around 4 threads).
I have a preview page that shows the images as they're downloading. The
threads that do the downloading trigger an event every 32K (the size of the
chunks I receive), at which point the images are drawn in the Preview page.
To create the images, I create a memory stream from the data and then use
Image.FromStream(). This works fine, but it's VERY cpu intensive. The images
being downloaded vary in size, but figure about 1000x1500 as average.
I tried using FreeImage and the FreeImage.NET wrapper, but that was even
more CPU intensive. Most of the time appears to have been spent in
FreeImage.GetBits() which I use to get the bits to copy into the DibSection,
though it's hard to be sure. pInvoke stuff seems to confuse nProf a bit.
Anyway, I'd love to find a less CPU intensive way to do this. Obviously,
what I'm showing is scaled down copies of these images in the PreviewPage,
so I don't really need the full-size image, but as far as I know, there's no
way to load the image scaled such that uses less CPU.
Anyone have any ideas for how I can improve this? Any open source libraries
that are maybe less CPU intensive than FreeImage?
Thanks.
1-20 threads concurrently (though generally around 4 threads).
I have a preview page that shows the images as they're downloading. The
threads that do the downloading trigger an event every 32K (the size of the
chunks I receive), at which point the images are drawn in the Preview page.
To create the images, I create a memory stream from the data and then use
Image.FromStream(). This works fine, but it's VERY cpu intensive. The images
being downloaded vary in size, but figure about 1000x1500 as average.
I tried using FreeImage and the FreeImage.NET wrapper, but that was even
more CPU intensive. Most of the time appears to have been spent in
FreeImage.GetBits() which I use to get the bits to copy into the DibSection,
though it's hard to be sure. pInvoke stuff seems to confuse nProf a bit.
Anyway, I'd love to find a less CPU intensive way to do this. Obviously,
what I'm showing is scaled down copies of these images in the PreviewPage,
so I don't really need the full-size image, but as far as I know, there's no
way to load the image scaled such that uses less CPU.
Anyone have any ideas for how I can improve this? Any open source libraries
that are maybe less CPU intensive than FreeImage?
Thanks.