views:

310

answers:

2

How do you re-size a black and white image without any smoothing affect? I have a BarCode that is an image that is too big. I need to resize the image but with one caveat. The resulting image needs to be the same proportional size and the black and white bars can not turn into black,grey and white bars(which I believe is due to some smoothing occuring). Any example of how to do this in c#??

+1  A: 

You can specify the smoothing mode in the underlying Graphics object.

arul
+1  A: 

@arul is correct. To be specific,

graphics.SmoothingMode = SmoothingMode.None;
graphics.DrawImage( barCodeImage, new Point( 0, 0 ) );

You might also want to check out the InterpolationMode, to see whether changing this value gives you results closer to what you want.

harpo