Code covered by the BSD License  

Highlights from
Base64 Image Encoder

Be the first to rate this file! 8 Downloads (last 30 days) File Size: 2.51 KB File ID: #24514

Base64 Image Encoder

by Michael Katz

 

22 Jun 2009

Encode a MATLAB (R) figure or file on disk as a string in Base64

| Watch this File

File Information
Description

Base64img takes a MATLAB figure and encodes it as a JPEG in a base64 string. This string can be used directly in a web page to display an image without an image file (in a subset of browsers only- 32 bit Windows and Linux).

Base64file takes a file on disk and encodes it as a base64 string.

This submission uses the Apache Commons Codec library to perform the encoding http://commons.apache.org/codec/

MATLAB release MATLAB 7.8 (R2009a)
Other requirements To
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
05 Feb 2010 Binod Pant

I am trying to embed an image in HTML, and the output I generate works in Firefox, but in IE8, I get a partial image. In IE6, nothing shows up.

I did not attach my HTML, as it would be too large. I do not see a file attach button here. I generated the base64 code using base64img.m.

Have you run into this issue before, and if so, how did you resolve it? Please note that I cannot use a separate CSS file, I have to have a single file output due to the nature of the work I am doing.

08 Feb 2010 Michael Katz

Binod, IE6 does not support embedded base64 images, and in IE8, there is a character length limit on URIs so that is why you only receive a partial image. The only workarounds I've seen was to create a program to run on the server to take the encoded image and create a file out of it.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
web Michael Katz 30 Jun 2009 12:34:15
encoding Michael Katz 30 Jun 2009 12:34:15
figure Michael Katz 30 Jun 2009 12:34:15

Contact us at files@mathworks.com