By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,734 Members | 832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,734 IT Pros & Developers. It's quick & easy.

Fastest way to resize bitmap with Picturebox

P: n/a
Hi,

I've got a Picturebox, into which I am putting a frame bitmap from a video
camera. The camera bitmap is larger than the picturebox, which has SizeMode
set to "Zoom" which causes the bitmap to be resized and correctly displayed.

My question is whether letting the Picturebox do the bitmap resizing is the
most efficient mechanism, or whether it would be preferable to perfrom the
resizing myself before passing the modified image to the Picturebox?

Cheers,

Jon.
Jun 8 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Jon,

I imagine it uses GDI+ (through the Graphics object) to perform the
scaling. If you think you can do better than that (I understand that GDI+
has some performance issues, so I don't blame you), then by all means go for
it. You can always perform some tests and see for yourself.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jon Parry" <Jo******@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
Hi,

I've got a Picturebox, into which I am putting a frame bitmap from a video
camera. The camera bitmap is larger than the picturebox, which has
SizeMode
set to "Zoom" which causes the bitmap to be resized and correctly
displayed.

My question is whether letting the Picturebox do the bitmap resizing is
the
most efficient mechanism, or whether it would be preferable to perfrom the
resizing myself before passing the modified image to the Picturebox?

Cheers,

Jon.

Jun 8 '07 #2

P: n/a
On Fri, 08 Jun 2007 09:54:01 -0700, Jon Parry
<Jo******@discussions.microsoft.comwrote:
[...]
My question is whether letting the Picturebox do the bitmap resizing is
the
most efficient mechanism, or whether it would be preferable to perfrom
the
resizing myself before passing the modified image to the Picturebox?
Depends on what you are asking and how often the given image will be
redrawn.

You aren't likely to be able to scale the bitmap once faster than .NET.
However, if you want to be able to efficiently handle resizing or
redrawing the same image repeatedly (for example, changing the size of the
PictureBox, or dealing with other windows getting moved on top of your
PictureBox, etc.) then caching a resized version of the Bitmap and using
that for the PictureBox may be better.

Of course, that assumes that PictureBox doesn't make it's own cached
version of the original bitmap. I haven't tested that, and maybe it does.

I certainly wouldn't bother doing any caching unless I actually ran into
some sort of UI performance problem.

Pete
Jun 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.