Solved

Inline bitmap, Data URL and RLE compressed data in JavaScript

Posted on 2007-04-11
8
490 Views
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");
  div.appendChild(pic);
}

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.
0
Comment
Question by:gzjimfan
  • 4
  • 2
8 Comments
 
LVL 5

Expert Comment

by:NickVd
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.
0
 

Author Comment

by:gzjimfan
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.
0
 
LVL 5

Expert Comment

by:NickVd
ID: 18893431
Ah..

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! :)
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:gzjimfan
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..
0
 
LVL 5

Expert Comment

by:NickVd
ID: 18893599
image magick (though I'm not 100% on the language)
0
 
LVL 5

Accepted Solution

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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery GMAP3 Hierarchy 1 24
javascript comparing two dates 3 18
How can I enable / disable a text box with a checkbox 3 17
Javascript Form Change 5 17
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

776 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