Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help scale up an image without distorting it.

Posted on 2007-11-27
4
Medium Priority
?
2,167 Views
Last Modified: 2010-04-21
Hi All.

I have a small bmp that i created. 4 pixels wide and 4 pixels high.  When i display it in a picture box i want to be able to actually see the pixels rather than just a dot on the screen so i say stretch.  The problem is that it smooths out the pixels and is not an exact representation of the image like i see in my image viewer.

Any ideas on how to display the exact 4x4 pixel image but say 100x100 so the top left pixel was copied actuall 25x25 pixels without coding it myself?  

Thanks
0
Comment
Question by:asiminator
[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
  • 2
4 Comments
 
LVL 7

Expert Comment

by:tcicatelli
ID: 20357486
A 4x4 bmp only has 16 pixels of information.  You can't expect to be able to stretch it to 100x100 (10,000 pixels) and maintain the same look.  Why don't you just recreate the bmp in the larger size?
0
 

Author Comment

by:asiminator
ID: 20357587
im not sure you understand.  im only interested in 16 pixels.  I just want a zoom function like a have in gimp or picture viewer or paint or any other tool that lets you look at each pixel in a expanded view
0
 
LVL 44

Accepted Solution

by:
Chris Stanyon earned 375 total points
ID: 20357829
You need to set the interpolation mode of the image, which I think you can only do in code. There doesn't seem to be a property for this in the designer.

In the paint event of the PictureBox add the following

        Dim PicWidth As Integer = 100
        Dim PicHeight As Integer = 100
        e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor
        e.Graphics.DrawImage(New Bitmap(Me.PictureBox1.Image), New RectangleF(0, 0, PicWidth, PicHeight))

This will 'zoom' into your image, rather than resizing it.

0
 

Author Closing Comment

by:asiminator
ID: 31411178
the zoom seems to crop the left and the top of the image by about 10 pixels.  Not sure why...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

610 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