Tuesday, November 24, 2009

Reduce Image size wince smart device mobile application

Does any one tried to reduce the size of the image in windows based mobile application using dot net libraries if yes then please post me the URL. but i have figured out an easy way of reducing the image size.

We can use opennetcf's dll's.
About opennetcf :- its a community to develop windows based mobile application.You can find many dlls free to use it in our application.

I just tried with OpenNETCF dll for my image reduce functionality.

Code:
 place the code in any button onclick event



 Dim objImage As System.Drawing.Image
Dim fractionalPercentage As Double
  fractionalPercentage = 20 / 100


 objImage = New Bitmap(FILEPATH)

 Dim bi As OpenNETCF.Drawing.Imaging.IBitmapImage
  bi = OpenNETCF.Drawing.Imaging.ImageUtils.CreateThumbnail( _
                        fsred, New Size(objImage.Width * fractionalPercentage, objImage.Height * fractionalPercentage))




' pctreduced - picture box , the reduced image will be drawn in this control
 pctreduced.Image = _
                           OpenNETCF.Drawing.Imaging.ImageUtils.IBitmapImageToBitmap(bi)

No comments:

Post a Comment