Scaling Bitmaps

P

Peter Oliphant

I'm using the Bitmap class which has built in scaling for images been drawn
not at their original size. And it works amazing well, and I'm VERY
impressed!

However. Is there perchance more than one method this uses that can be
selectable? The one it uses is GREAT for photos, it kind of 'blurs' stuff
together so it never pixelates.

But I also have an image for which I wish it would just make the pixels
'larger'. That is, its an image with only black and white pixels, so when I
scale it to twice its size on each axis, I'd prefer in THIS case for it to
just reproduce the original image with each pixel now being 2x2 instead of
1x1.

I can easily write such a conversion, but was wondering if it too might be
built in as an option on HOW (the method used for) scaling is done. That is,
if it exists, I might as well not reinvent the wheel!

Are their such scaliing options built in?

Thanks for responses in advance!

[==P==]

PS - I'm using MS VC++ 2005 Express (an amazing language for FREE!!!!)
creating /clr managed code...
 
C

Carl Daniel [VC++ MVP]

Peter said:
I'm using the Bitmap class which has built in scaling for images been
drawn not at their original size. And it works amazing well, and I'm
VERY impressed!

However. Is there perchance more than one method this uses that can be
selectable? The one it uses is GREAT for photos, it kind of 'blurs'
stuff together so it never pixelates.

But I also have an image for which I wish it would just make the
pixels 'larger'. That is, its an image with only black and white
pixels, so when I scale it to twice its size on each axis, I'd prefer
in THIS case for it to just reproduce the original image with each
pixel now being 2x2 instead of 1x1.

I can easily write such a conversion, but was wondering if it too
might be built in as an option on HOW (the method used for) scaling
is done. That is, if it exists, I might as well not reinvent the
wheel!
Are their such scaliing options built in?

Thanks for responses in advance!

[==P==]

PS - I'm using MS VC++ 2005 Express (an amazing language for FREE!!!!)
creating /clr managed code...

The .NET Bitmap class used GDI+ under the covers to do all of the heavy
lifting. Most of the raw interface ot GDI+ is exposed through the
System.Drawing.Graphics class. You can use the CompositingQuality property
of the Graphics class to choose between several different modes, one of
which is "HighSpeed", which should do no smoothing.

You need to make sure that when you say 2X you really mean 2X, but if your
target image size is exactly 2X in each dimension, and you've specified
CompositingQuality.HighSpeed, I would expect that you'll get simple pixel
doubling. I'm not sure that GDI+ guarantees that, however, so you'll have
to experiment to see if it'll do what you want.

Hope that helps - Since you didn't say exactly what you're doing to cause
the image to be scaled, I may be leading you down the wrong path!

-cd
 
P

Peter Oliphant

Hi Carl!

Not to worry, you steered me down the absolutely CORRECT path! That was
EXACTLY what I was looking for! Thanx! : )

[==P==]

Carl Daniel said:
Peter said:
I'm using the Bitmap class which has built in scaling for images been
drawn not at their original size. And it works amazing well, and I'm
VERY impressed!

However. Is there perchance more than one method this uses that can be
selectable? The one it uses is GREAT for photos, it kind of 'blurs'
stuff together so it never pixelates.

But I also have an image for which I wish it would just make the
pixels 'larger'. That is, its an image with only black and white
pixels, so when I scale it to twice its size on each axis, I'd prefer
in THIS case for it to just reproduce the original image with each
pixel now being 2x2 instead of 1x1.

I can easily write such a conversion, but was wondering if it too
might be built in as an option on HOW (the method used for) scaling
is done. That is, if it exists, I might as well not reinvent the
wheel!
Are their such scaliing options built in?

Thanks for responses in advance!

[==P==]

PS - I'm using MS VC++ 2005 Express (an amazing language for FREE!!!!)
creating /clr managed code...

The .NET Bitmap class used GDI+ under the covers to do all of the heavy
lifting. Most of the raw interface ot GDI+ is exposed through the
System.Drawing.Graphics class. You can use the CompositingQuality
property of the Graphics class to choose between several different modes,
one of which is "HighSpeed", which should do no smoothing.

You need to make sure that when you say 2X you really mean 2X, but if your
target image size is exactly 2X in each dimension, and you've specified
CompositingQuality.HighSpeed, I would expect that you'll get simple pixel
doubling. I'm not sure that GDI+ guarantees that, however, so you'll have
to experiment to see if it'll do what you want.

Hope that helps - Since you didn't say exactly what you're doing to cause
the image to be scaled, I may be leading you down the wrong path!

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top