PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
how to do bitmap scaling in compactframework
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
how to do bitmap scaling in compactframework
![]() |
how to do bitmap scaling in compactframework |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
hi,
i am facing acertian problem in scaling an image in compactframework. i have got a certain piece of code written below which i have written for ..net framework and need to convert it for compactframework. ************************************************************ scaledImg = new Bitmap(img,(int)(img.Width*scale),(int)(img.Height*scale)); ************************************************************ i tried just could found only this alternative ********************************************************** scaledImg = new Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale)); ********************************************************** But due to this i am getting wrong results . Can anyone please help in converting the above function in compactframe work. waiting for reply eagerly. Regards Naveen |
|
|
|
#2 |
|
Guest
Posts: n/a
|
> scaledImg = new
> Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale)); Try the following: Bitmap scaledImg = new Bitmap((int)(img.Width*scale), (int)(img.Height*scale)); using (Graphics gfx = Graphics.FromImage(scaledImg)) { gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes()); } Christian |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Sir, what is this new Imaging.ImageAttributes(); as it is giving me error. regards Naveen "Christian Schwarz" wrote: > > scaledImg = new > > Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale)); > > Try the following: > > Bitmap scaledImg = new Bitmap((int)(img.Width*scale), > (int)(img.Height*scale)); > > using (Graphics gfx = Graphics.FromImage(scaledImg)) > { > gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0, > img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes()); > } > > Christian > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Sir ( new Imaging.ImageAttributes()) it is giving me this sort of error : "The type or namespace name 'Imaging' could not be found (are you missing a using directive or an assembly reference?)" "Christian Schwarz" wrote: > > scaledImg = new > > Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale)); > > Try the following: > > Bitmap scaledImg = new Bitmap((int)(img.Width*scale), > (int)(img.Height*scale)); > > using (Graphics gfx = Graphics.FromImage(scaledImg)) > { > gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0, > img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes()); > } > > Christian > > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Sir, I want to assign a scaled bitmap into another bit map how to do it.i have got a.net framework function which is working fime and i need an alternative for it to make it working for .net compactframework. ************************************************************ scaledImg = new Bitmap(img,(int)(img.Width*scale),(int)(img.Height*scale)); ************************************************************ How can this be done. regards Naveem "Naveen koul" wrote: > > Sir > ( new Imaging.ImageAttributes()) > it is giving me this sort of error > : "The type or namespace name 'Imaging' could not be found (are you missing > a using directive or an assembly reference?)" > > "Christian Schwarz" wrote: > > > > scaledImg = new > > > Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale)); > > > > Try the following: > > > > Bitmap scaledImg = new Bitmap((int)(img.Width*scale), > > (int)(img.Height*scale)); > > > > using (Graphics gfx = Graphics.FromImage(scaledImg)) > > { > > gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0, > > img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes()); > > } > > > > Christian > > > > > > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
> Sir,
I'm not a Sir ![]() > what is this new Imaging.ImageAttributes(); as it is giving me error. ImageAttributes class resides in the "System.Drawing.Imaging" namespace. Christian |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


