views:

426

answers:

3

Hi, I'm using a picturebox to display images in a form. If the image is 10X10 pixels and the picturebox size is 100X100 I would like to make the image larger for using the whole picturebox area. When using the zoom property for the picturebox the pixels of the image is smeared out. How to fill the area of the picturebox with a smaller Image and maintain the pixel quality of the image.

+1  A: 

You might want to look into creating your own exploded bitmap and then set that as the image of your PictureBox. The most naive approach would be to create a new 100x100 Bitmap, and SetPixel in 10x10 blocks.

lc
Made a larger bitmap as the size of the picturebox. Used interpolationmode NearestNeighbor to not smear the pixels.
humcfc
@humcfc That works too, and (probably) faster than SetPixeling one by one in managed code
lc
A: 

Given lc's suggestion, you could see this link for some libraries to use.

akappa
A: 

If you've got time for doing automated processing beforehand, you could try 3rd party software, something like http://www.imagemagick.org/script/index.php

David Archer