Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

How to Convert file laoding image pixel size....into user required fomrat size.

$
0
0

I Have One filed that is  signature in these ,I am used File upload control... i am upload the image  ..user give some signature image..based on that  ....what is size and what is pixel format of picture ...I am want to set that signature image to "180X35" pixel  size ...but here image width and height is .....get property ..but i am used Bitmap ...but It show Only" Light Gray" not show any image...........the following code is below....can replay me...you how to set pixel size of image in .aspx.cs file 

  byte[] fileData;
        if (ImgImages.UploadedFiles.Count > 0)
        {
            UploadedFile file = ImgImages.UploadedFiles[0];
            
            RadBinaryImage RadBi = new RadBinaryImage();
            System.Drawing.Image myImage = System.Drawing.Image.FromStream(file.InputStream);
            Bitmap b = new Bitmap(myImage);
            System.Drawing.Imaging.BitmapData bi=new System.Drawing.Imaging.BitmapData();
            Bitmap biImageConvert = new Bitmap(180, 35,bi.Stride , myImage.PixelFormat,bi.Scan0);

            byte [] f1=imageToByteArray(biImageConvert);
            oCheck.Signature = f1;

}

 public byte[] imageToByteArray(System.Drawing.Bitmap imageIn)
    {
        MemoryStream ms = new MemoryStream();
        imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
        return ms.ToArray();
    }

where wrong with bitmap in above code...why i am getting gray color image not  original  one...type image after converstion.


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>