Solved

Help scale up an image without distorting it.

Posted on 2007-11-27
4
2,162 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 43

Accepted Solution

by:
Chris Stanyon earned 125 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 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