Solved

VB.NET Picturebox Blurring Smaller Images

Posted on 2008-06-15
5
1,394 Views
Last Modified: 2013-11-26
Hi Experts,

I'm developing a graphical processing package in (possibly the worst language for this!!) VB.NET, and part of this involves me showing a small 10x10 or 50x50 pixel image in a large picturebox. The VB.NET control is blurring the image, making it impossible to distinguish between the pixels. The picturebox is on 'Stretch' mode, in order to bring the pixels to a viewable level.

If any experts know how to either change the properties of the picture box, or how to scale up the image without using get/setpixel as this is too slow for my application then i would be most appreciative.

Tom
0
Comment
Question by:daveford123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
rachitkohli earned 500 total points
ID: 21791114
You may try picturebox property SizeMode=Zoom
Since this will fit in the picture box, but will also mantain the aspect ratio of the image.
To resize the image, dont use Get/Set pixels, you may use the graphics object DrawImage method.
But if you use DrawImage method, you need to set the width, height manually (if required need to also keep in mind about the aspect ratio, since its a very important factor while resizing an image)

Just a note, vb.net is not a worst language for Graphical Processing any more, since it has a powerful GDI+ class library, which can do anything.
I have managed to make a full fledged photo editing software with multi-layer it.

0
 
LVL 14

Expert Comment

by:rachitkohli
ID: 21791124
a nice site to understand the fundamentals about gdi+

http://bobpowell.net/
0
 

Author Comment

by:daveford123
ID: 21807740
Rachitkohli, That site is just what im looking for, with the translation matrix(es). the only issue im having now is changing the graphics object into the image data type that the picturebox can display. Any ideas?
0
 

Author Comment

by:daveford123
ID: 21808063
Thought this might help; this is the code im using currently, and getting a 'generic error'. Previously i was using the commented code and getting a 'type mismatch' error.
        Dim e As Graphics
        e = Graphics.FromImage(TempImg)
        e.Transform = New Drawing2D.Matrix(50, 0, 0, 50, 0, 0)
        COMP_TRANS.Image = e
        COMP_TRANS.Image = Image.FromHbitmap(e.GetHdc)

Open in new window

0
 

Author Closing Comment

by:daveford123
ID: 31467413
Cheers for that - good site, good advice
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where does legacy ASP.NET initialize language? 2 59
asp.net figure out error 3 23
Asp.Net Session Question 2 34
VB.net/VSTO Excel Add-in 2 16
A short article about a problem I had getting the GPS LocationListener working.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question