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 945637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:47:02+00:00 2026-05-15T22:47:02+00:00

I am retrieving a byte array of a pictureStream from a .net webservice. the

  • 0

I am retrieving a byte array of a pictureStream from a .net webservice. the JSON byte array response looks like this:

[137, 80, 78, 372, 617 more...]

I am trying to convert this byte array and draw it into an HTML canvas like this

var context = document.getElementById('boxcover').getContext('2d');
context.putImageData(movies.PictureStream, 0, 0);

But this doesn’t work. I have no access the modify the webservice, so I am looking to convert this byte array into a picture using Javascript only. Also, I can’t use server side scripting, client side only.

Thanks for the help

Here is an example of how the byte array comes in : http://www.copypastecode.com/33072/

  • 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-15T22:47:03+00:00Added an answer on May 15, 2026 at 10:47 pm

    It depends what exactly is in the byte array. If it’s a series of RGB or RGBA values, you can use getImageData/putImageData to draw it such as Kieranmaine mentioned.

    But if the byte array is simply the data from a jpeg or other image format, you likely won’t be able to access the individual pixel data in that manner.
    In such a case you might try converting it to base 64 to create a dataURI, creating an image element, setting the source to that dataURI and using drawImage to place it on the canvas.

    To convert from a byte array to a data URI, you’ll need to know the mime type first.
    But if you know it, try this code.

    'data:image/png;base64,' + btoa(String.fromCharCode.apply(this, byteArray));

    After setting the src attribute of the img element it’s possible you may need to wait for its load event to fire before calling the context’s drawImage() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am retrieving an image from the SQL database into Byte() variable in VB.NET.
I would like to create a new System.Windows.Xps.Packaging.XpsDocument object from byte array, as I
I am recieving array of bytes from JSON webservice and it is a jpg
I'm retrieving a batch of items using their keys, with something like this: from
I have an ActiveX component which receives byte array from javascript and process it.
I am trying to retrieving image from sql server 2005 into asp.net web page
I am retrieving some configuration from a service and passing this data to the
I am retrieving a String from SOAP service to asp.net. I am not able
I have to retrieve first bit from 1 byte. For this i stored whole
When retrieving a lookup code value from a table, some folks do this... Dim

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.