Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Inline bitmap, Data URL and RLE compressed data in JavaScript

Posted on 2007-04-11
Medium Priority
Last Modified: 2013-11-19
Hi experts,

I have a RLE compressed bitmap encoded in base64, and I would like to use inline bitmap (data URL) to display this picture in FireFox. It looks like fire fox can't display my bitmap, does anyone know why?

My code that displays the bitmap is:

function display(base64str)
   var pic = document.createElement('img');
   pic.src = 'data:image/bmp;base64,' + base64str;
  var div = document.getElementById("mydiv");

I tried with none RLE compressed bitmap and it works fine.  So I am wondering if RLE is even supported in data URL kind of usage.
Question by:gzjimfan
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Expert Comment

ID: 18893250
Is there reason why you're using a bmp file instead of a gif or a jpeg?

Try data:image/gif;base64 or data:image/jpeg;base64 instead of data:image/bmp;base64

Also, make sure than your encoded string is not corrupt.

Author Comment

ID: 18893364
The target I am working on is running on an embedded platform which does not support bitmap to jpeg/gif compression (or I would have to port code to do that), that's why I am using RLE to do it because it's much simpler. I think the base64 encoded data is OK because using the same code to encode the none-RLE compressed data can get a proper picture display.

If there's no other way to display encoded RLE bitmap I will need to look into solutions to compress jpeg images on the embedded platform.

Thanks for your response.

Expert Comment

ID: 18893431

Well since you're on an embedded system, I don't know how much help I can be other than suggesting you talk with the manufacturer.

Good luck! :)
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 18893450
:) I am the manufacturer (designer that develops the embedded device).

If you know a free piece of source code that compresses JPEG from bitmap in C/C++, please let me know..

Expert Comment

ID: 18893599
image magick (though I'm not 100% on the language)

Accepted Solution

NickVd earned 2000 total points
ID: 18893604
Sorry, thought I linked... http://www.imagemagick.org/script/index.php

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question