PC Review


Reply
Thread Tools Rate Thread

how to do bitmap scaling in compactframework

 
 
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
Posts: n/a
 
      4th Oct 2005
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




 
Reply With Quote
 
 
 
 
Christian Schwarz
Guest
Posts: n/a
 
      4th Oct 2005
> 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


 
Reply With Quote
 
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
Posts: n/a
 
      4th Oct 2005

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
>
>
>

 
Reply With Quote
 
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
Posts: n/a
 
      4th Oct 2005

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
>
>
>

 
Reply With Quote
 
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
Posts: n/a
 
      4th Oct 2005

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
> >
> >
> >

 
Reply With Quote
 
Christian Schwarz
Guest
Posts: n/a
 
      4th Oct 2005
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scaling a bitmap in a picturebox Eric Microsoft Dot NET 1 7th Aug 2006 11:14 AM
Scaling a bitmap in a picturebox Eric Microsoft VB .NET 2 7th Aug 2006 11:14 AM
Scaling a bitmap correctly? James Dean Microsoft C# .NET 1 21st Jul 2004 02:06 PM
Re: Bitmap scaling quality Herfried K. Wagner [MVP] Microsoft Dot NET Framework Forms 1 28th May 2004 04:26 PM
Question on how to access bitmap: Public Function getBitmap() As Bitmap Michael Murphy Microsoft VB .NET 2 7th Oct 2003 02:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 PM.