473,545 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fastest way to resize bitmap with Picturebox

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
2 8580
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.co m

"Jon Parry" <Jo******@discu ssions.microsof t.comwrote in message
news:E6******** *************** ***********@mic rosoft.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
On Fri, 08 Jun 2007 09:54:01 -0700, Jon Parry
<Jo******@discu ssions.microsof t.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
17155
by: Paul Jaeger | last post by:
I have jpeg images that are 2848 x 4256 pixels. I want to programatically convert them to images that are approximately 427 x 638 (that maintains the ratio) and save to new jpeg files. How can .net accomplish the image resizing? Paul J.
2
1737
by: tom | last post by:
Hello, does anyone know if and how it is possible that when you use an image as backgroundimage of a form, this image adjusts itself when the form resizes. Sth. like 'StretchImage' for a picturebox. thanx, t
5
1998
by: active | last post by:
This is what I do in a PictureBox New: b1 = New Drawing.Bitmap(Width, Height, Me.CreateGraphics()) g1 = Graphics.FromImage(b1) Someplace I do g1.DrawString.........
2
4524
by: Peter Proost | last post by:
Hi group I have the following piece of code that should resize the bitmap in a picture box but it doesn't work as I tought it would. Can someone help me with it? thnx Peter Public Class Form1 Inherits System.Windows.Forms.Form
2
9414
by: Carl Gilbert | last post by:
Hi I am looking for either a component or technique to allow me to do the following: * Provide a panel with a background image * Resize the image to best fit the panel to maintain aspect ratio * Provide white (or other color) borders at the sides or the top/bottom The last point would be used to allow users to resize the panel to any...
15
5311
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run...
4
2548
by: John Swan | last post by:
Hello. I'm trying to create a simple program that amongst other things creates a thumbnail of an image (Bitmap) to a set size determined by the user in pixels? The problem is: All of the examples I have seen so far are in c#. Can anyone please provide reference to a c++ managed version. Thanks. John
7
5988
by: kebalex | last post by:
Hi, I have an app (written in .NET 2.0) which updates a picturebox according to some user input (a slider control). when the user makes a change i loop through all of the pixels, do a calculation and update the picture. i currently use the GDI SetPixel method on each pixel of the Pictureboxes image. This is proving far to slow, about 1.5...
2
20884
by: Dominic Vella | last post by:
Hi, I know I seem to have the really complicated questions, but I guess that's why I'm here. This is a little verbose, only because I've been trying to crack this for a week now. Your help would be appreciated. I've been trying numerous ways to resize images, as I want to make store thumbnails, not full images in my database. ...
0
7465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.