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

  • Home
  • SEARCH
  • 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 7943683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:20:32+00:00 2026-06-04T00:20:32+00:00

I have been using the sql ce to bring some data onto my application.

  • 0

I have been using the sql ce to bring some data onto my application. Now I need to add some of the images to make it look pretty. What all I want to know is

  1. There must be some image to byte conversion done,
  2. Retrieve the image byte code and convert back into the image.

I’ve got stuck at the second part and how am I supposed to continue?

Any links or examples are needed for the reference.

Thanks a lot.

  • 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-06-04T00:20:34+00:00Added an answer on June 4, 2026 at 12:20 am

    Here’s some ideas I have used in the past.

    The image column in the DB:

    [Column]
    public byte[] MyImage
    {
      get { return _myImage; }
      set
      {
        if (_myImage != value)
        {
          _myImage = value;
          NotifyPropertyChanging("MyImage");
          NotifyPropertyChanged("MyImage");
        }
      }
    }
    

    Save image:

    public void AddNewImage(Stream image, string url)
    {
      byte[] byteArray = GetImageBytes(image);
    
      var item = new MyDatabaseItem { Count = 1, ItemImageUrl = url, MyImage = byteArray };
      MyDatabaseItemModel.Add(item);
      MyDatabaseDB.MyDatabaseItems.InsertOnSubmit(item);
      MyDatabaseDB.SubmitChanges();
    }
    

    Get image:

    private byte[] GetImageBytes(Stream stream)
    {
      using (var ms = new MemoryStream())
      {
        var writeableBitmap = PictureDecoder.DecodeJpeg(stream, 200, 200);
        writeableBitmap .SaveJpeg(ms, 200, 200, 0, 30);
        return ms.ToArray();
      }
    }
    

    Using a value converter:

    public class ImageConverter: IValueConverter
    {
      public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
      {
        if (value is byte[])
        {
          var memoryStream = new MemoryStream(value as byte[]);
          varwriteBitmap = PictureDecoder.DecodeJpeg(memoryStream, 200, 200);
          return writeBitmap;
        }
        else
          return null;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
          throw new NotImplementedException();
        }
    }
    

    And finally bind it in XAML:

    <Image Source="{Binding MyImage, Converter={StaticResource ImageConverter}}" Stretch="UniformToFill"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to add columns to a table using some logic that
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I have been using SQL Compare by Redgate at my company and was very
I am pretty much new to using SQL Server 2000. I have been using
I have a Linq-To-Sql based repository class which I have been successfully using. I
I am using Microsoft SQL Server. I have a Table which had been updated
I've been useing VS2005 to create sql reports and now have to upgrade to
I have been using the CodeIgniter system for a while now - but it
I have been using WPF for a few years now and don't have any
I have some rather dodgy data I'm looking at, and I've been tasked with

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.