Click here to Skip to main content
15,916,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have to display finger print image stocket in database in may ASP.net mvc5 view.

i find a solution to display it in wpf :

WPF code :

try
{
    BinaryReader br = new BinaryReader(image);
    byte pixByte;
    int i;
    int iTotalSize = (int)br.BaseStream.Length;

    // Get the dimensions of the image from the user
    ID = new ImageDimensions(iTotalSize);
    if (ID.ShowDialog() == true)
    {
        width = Convert.ToInt32(ID.tbWidth.Text);
        height = Convert.ToInt32(ID.tbHeight.Text);
        canvas.Width = width;
        canvas.Height = height;
        img.Width = width;
        img.Height = height;
        pix08 = new byte[iTotalSize];

        for (i = 0; i < iTotalSize; ++i)
        {
            pixByte = (byte)(br.ReadByte());
            pix08[i] = pixByte;
        }
        br.Close();

        int bitsPerPixel = 8;
        stride = (width * bitsPerPixel + 7) / 8;

        // Single step creation of the image
        bmps = BitmapSource.Create(width, height, 96, 96, PixelFormats.Gray8, null,
            pix08, stride);
        img.Source = bmps;

    }
    else
    {
        br.Close();
    }
}
catch (Exception e)
{
    MessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}



i want to implement like this code to read the finger Print image in asp.net mvc .

Thank you

What I have tried:

var base64 = Convert.ToBase64String(image);
var imgSrc = String.Format("data:image/gif;base64,{0}", base64);


but didn't work
Posted
Updated 12-Jul-17 6:30am

1 solution

Looks like it is pretty simple. Read the article C# Image to Byte Array and Byte Array to Image Converter Class.

Learn to google...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900