Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:13:14+00:00 2026-05-26T15:13:14+00:00

i get image from client convert it to byte[] and send it to server.

  • 0

i get image from client convert it to byte[] and send it to server. And convert byte[] to Base64String and insert into database.

And i do reverse to show image. But i cant see the image. Why???

//Convert to byte array
 public static byte[] ImageToByteArray(WriteableBitmap bitmap)

{
            int[] p = bitmap.Pixels;
            int len = p.Length << 2;
            byte[] result = new byte[len];
            Buffer.BlockCopy(p, 0, result, 0, len);
            return result;
}

//Converter
public object Convert(object value, Type targetType, object parameter,System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return null;
            }

            BitmapImage image = new BitmapImage();

            MemoryStream stream = new MemoryStream();
            stream.Write((byte[])value, 0, ((byte[])value).Length);
            image.SetSource(stream);


            return image;
        }

//While writing to database
else if (value.GetType() == typeof(byte[]))
            {
                return "'" + Convert.ToBase64String((byte[])value) + "'";
            }

else if ((type == typeof(byte[])))
            {
                return Convert.FromBase64String((string)value);
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:13:15+00:00Added an answer on May 26, 2026 at 3:13 pm

    I used BinaryReader and solved the problem.

    My problem was not reading the image correct. iused BinaryReader to read the image and solved the problem.

                    BinaryReader reader = new BinaryReader(fileInfo.OpenRead());
    
                    byte[] tempImage = new byte[reader.BaseStream.Length];
    
                    reader.Read(tempImage, 0, tempImage.Length); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get an image from a SQL Server as a byte[], and
i need to get an image from client and displayed(preview) before saving it into
I am trying to get an image from an HTTP server using Perl. I
I have a code that will show the image got from a local client.
How do you get a image from the scanner using .NET (C#) on Vista?
My problem is that I can't seem to get the image from my bundle
What and how is the best way to get an image from a URL
How to get the perticluar image from large set images in one image using
Does anybody know how to get thumbnail (still image) from 3gb video file? First
can any one guide me how to get parameter specially image from the given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.