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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:43:35+00:00 2026-05-14T22:43:35+00:00

Is it possible, or reasonable, to encode bitmap data into JSON to be returned

  • 0

Is it possible, or reasonable, to encode bitmap data into JSON to be returned in a webservice?

Update: Yes, this worked better than I thought. I made a .NET composite object for a combination of images together with image data

Public Class AllThumbnails
Public imgAllThumbs As String
Public positions() As Drawing.Rectangle
End Class

and accessed it via jQuery AJAX thusly:

$.ajax({
    type: "POST",
    url: "WebService.asmx/makeAllThumbnailsImage",
    data: "{DocumentNumber : \"" + DocumentNumber + "\"} ",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response) {
        var adl = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;

        var data = Base64.decode(adl.imgAllThumbs);
        $('#output').append("<p><strong>" + data.length + "</strong></p>");
        $('#output').append("<p><strong><i>" + adl.positions.length + "<i></strong></p>");

    },
    failure: function (msg) {
        $('#output').text(msg);
    }
});

I did have to increase a value in my web.config since my image data was overrunning the standard jsonSerialization buffer:

  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="262144">
        </jsonSerialization>
      </webServices>
    </scripting>
  </system.web.extensions>

Thanks guys for your help.

  • 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-14T22:43:36+00:00Added an answer on May 14, 2026 at 10:43 pm

    A bitmap is binary data. JSON is to be represented as character data. So you need to convert binary data to character data and vice versa without loss of information. A commonly used encoding for this is Base64. It’s unclear which programming language you’re targeting on, so I can’t give a more detailed answer, but almost all self-respected languages have either a builtin Base64 encoder or a 3rd party library which can do that. PHP for example has base64_encode() and base64_decode(). Java has Apache Commons Codec Base64. For JavaScript there is this example. And so on.

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

Sidebar

Related Questions

Is it possible (and reasonable) to write Controller tests and classes before writing the
Is it possible to solve a problem of O(n!) complexity within a reasonable time
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: What is a reasonable code coverage % for unit tests (and why)?
Possible Duplicates: Is it reasonable to assume my visitors have javascript enabled? How many
We've got a reasonable sized C++ application that's pretty old at this stage, so
I'm not sure if it's possible but it seems a little bit reasonable to
Not sure if it's possible, but it sounds reasonable. I have a list of
Is it possible/feasible/reasonable to use HAProxy to load-balance three SQL Server 2008 database servers?

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.