FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Online Base64 Image Encoder/Decoder

Convert image base64 using this tool to base64 encode images for use in html, css, javascript, etc

Convert image base64 encoder

Base64 Image Converter BETA
  • Reverse Base64
  • Optionally optimize the images first (including animated gif/png)
  • Instructions for optimal caching and use, which is so essential.
  • Favicons, Javascript Caching, Mobile/Game Console/Tablet Info
  • Upload/Get a css file and automatically convert all the background-images in it to base64
  • Support many additional formats, including audio/video/text/etc
  • Conversion from one image format to another pre-base64
  • Multiple Uploads/Gets, Better Preview Options, Re-sizing
  • Image conversion for use in emails (non-remote, so no warning)

Base64 Image Data URL Scheme

Some applications that use URLs also have a need to embed (small) media type data directly inline. This document defines a new URL scheme that would work like 'immediate addressing'. The URLs are of the form: data:[<mediatype>][;base64],<data></data></mediatype> The <mediatype></mediatype> is an Internet media type specification (with optional parameters.) The appearance of ";base64" means that the data is encoded as base64. Without ";base64", the data (as a sequence of octets) is represented using ASCII encoding for octets inside the range of safe URL characters and using the standard %xx hex encoding of URLs for octets outside that range. If <mediatype></mediatype> is omitted, it defaults to text/plain;charset=US-ASCII. As a shorthand, "text/plain" can be omitted but the charset parameter supplied. The "data:" URL scheme is only useful for short values. Note that some applications that use URLs may impose a length limit; for example, URLs embedded within <a></a> anchors in HTML have a length limit determined by the SGML declaration for HTML [RFC1866]. The LITLEN (1024) limits the number of characters which can appear in a single attribute value literal, the ATTSPLEN (2100) limits the sum of all lengths of all attribute value specifications which appear in a tag, and the TAGLEN (2100) limits the overall length of a tag.

Data URL Scheme Syntax

dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
mediatype  := [ type "/" subtype ] *( ";" parameter )
data       := *urlchar
parameter  := attribute "=" value

SVN to base64

Yes this tool can convert svn to base64

Mobile Web Application Best Practices

Mobile Web Application Best Practices

Include Background Images Inline in CSS Style Sheets

Visual effects (e.g. background images and gradients) are often used to improve the look and feel of an application. These can be included in CSS as base64 encoded strings in order to avoid an additional HTTP request Note that base64 encoding adds around 10% to the image size after gzip compression and this additional cost should be weighed against the benefits of fewer requests. Background images can be encoded using the data URI scheme: url('data:image/png;base64, [data]) [ CSS ] Requires: RFC2397 data uri support.

Data URI scheme

The data URI scheme is a URI scheme (Uniform Resource Identifier scheme) that provides a way to include data in-line in web pages as if they were external resources. This technique allows normally separate elements such as images and style sheets to be fetched in a single HTTP request rather than multiple HTTP requests, which can be more efficient. Data URIs tends to be simpler than other inclusion methods, such as MIME with cid or mid URIs. Data URIs are sometimes called Uniform Resource Locators, although they do not actually locate anything remote. The data URI scheme is defined in RFC 2397 of the Internet Engineering Task Force (IETF). In browsers that fully support Data URIs for "navigation", Javascript generated content can be provided as file "download" to the user, simply by setting window.location.href to a Data URI. One example is the conversion of HTML tables to downloadable CSV using a Data URI like this: 'data:text/csv;charset=UTF-8,' + encodeURIComponent(csv), where "csv" has been generated by Javascript. The IETF published the data URI specification in 1998[1] as Proposed Standard on the IETF Standards Track, and hasn't progressed it since. The HTML 4.01 specification refers to the data URI scheme,[2] and data URIs have now been implemented in most browsers.

Web browser support

As of March 2012, Data URIs are supported by the following web browsers:
  • Gecko-based, such as Firefox, SeaMonkey, XeroBank, Camino, Fennec and K-Meleon
  • Konqueror, via KDE's KIO slaves input/output system
  • Opera (including devices such as the Nintendo DSi or Wii)
  • WebKit-based, such as Safari (including iOS), Android's browser, Kindle 4's browser, Epiphany and Midori (WebKit is a derivative of Konqueror's KHTML engine, but Mac OS X does not share the KIO architecture so the implementations are different), and Webkit/Chromium-based, such as Chrome
  • Trident
    • Internet Explorer 8: Microsoft has limited its support to certain "non-navigable" content for security reasons, including concerns that JavaScript embedded in a data URI may not be interpretable by script filters such as those used by web-based email clients. Data URIs must be smaller than 32 KB in Version 8.[3] Data URIs are supported only for the following elements and/or attributes:[4]
      • object (images only)
      • img
      • input type=image
      • link (data URI must be base64 encoded)
      • CSS declarations that accept a URL, such as background-image, background, list-style-type, list-style and similar.
    • Internet Explorer 9: Internet Explorer 9 does not have 32KB limitation and allowed in broader elements.

Advantages

  • HTTP request and header traffic is not required for embedded data, so data URIs consume less bandwidth whenever the overhead of encoding the inline content as a data URI is smaller than the HTTP overhead. For example, the required base64 encoding for an image 600 bytes long would be 800 bytes, so if an HTTP request required more than 200 bytes of overhead, the data URI would be more efficient.
  • For transferring many small files (less than a few kilobytes each), this can be faster. TCP transfers tend to start slowly. If each file requires a new TCP connection, the transfer speed is limited by the round-trip time rather than the available bandwidth. Using HTTP keep-alive improves the situation, but may not entirely alleviate the bottleneck.
  • When browsing a secure HTTPS web site, web browsers commonly require that all elements of a web page be downloaded over secure connections, or the user will be notified of reduced security due to a mixture of secure and insecure elements. On badly configured servers, HTTPS requests have significant overhead over common HTTP requests, so embedding data in data URIs may improve speed in this case.
  • Web browsers are usually configured to make only a certain number of (often two) concurrent HTTP connections to a domain,[5] so inline data frees up a download connection for other content.
  • Environments with limited or restricted access to external resources may embed content when it is disallowed or impractical to reference it externally. For example, an advanced HTML editing field could accept a pasted or inserted image and convert it to a data URI to hide the complexity of external resources from the user. Alternatively, a browser can convert (encode) image based data from the clipboard to a data URI and paste it in a HTML editing field. Mozilla Firefox 4 supports this functionality.
  • It is possible to manage a multimedia page as a single file.
  • Email message templates can contain images (for backgrounds or signatures) without the image appearing to be an "attachment".

Disadvantages

  • Data URIs are not separately cached from their containing documents (e.g. CSS or HTML files) so data are downloaded every time the containing documents are redownloaded.
  • Content must be re-encoded and re-embedded every time a change is made.
  • Internet Explorer through version 7 (approximately 5% of web traffic as of September 2011), lacks support. However this can be overcome by serving browser specific content.[6]
  • Internet Explorer 8 limits data URIs to a maximum length of 32 KB. (Internet Explorer 9 does not have this limitation)[3][4]
  • In IE 8 and 9 data URIs can only be used for images, but not for navigation or Javascript generated file downloads.[7]
  • Data are included as a simple stream, and many processing environments (such as web browsers) may not support using containers (such as multipart/alternative or message/rfc822) to provide greater complexity such as metadata, data compression, or content negotiation.
  • Base64-encoded data URIs are 1/3 larger in size than their binary equivalent. (However, this overhead is reduced to 2-3% if the HTTP server compresses the response using gzip)[8]
  • Data URIs do not carry a filename as a normal linked file would. When saving, a default filename for the specified MIME type is generally used.
  • Referencing the same resource (such as an embedded small image) more than once from the same document results in multiple copies of the embedded resource. In comparison, an external resource can be referenced arbitrarily many times, yet downloaded and decoded only once.
  • Data URIs make it more difficult for security software to filter content.[9]

Format

data:[<mime-type>][;charset=<encoding>][;base64],<data></data></encoding></mime-type>
The encoding is indicated by ;base64. If it's present the data is encoded as base64. Without it the data (as a sequence of octets) is represented using ASCII encoding for octets inside the range of safe URL characters and using the standard %xx hex encoding of URLs for octets outside that range. If <MIME-type> is omitted, it defaults to text/plain;charset=US-ASCII. (As a shorthand, the type can be omitted but the charset parameter supplied.) Some browsers (Chrome, Opera, Safari, Firefox) accept a non-standard ordering if both ;base64 and ;charset are supplied, while Internet Explorer requires that the charset's specification must precede the base64 token.

What tools does Smush.it use to smush images?

We have found many good tools for reducing image size. Often times these tools are specific to particular image formats and work much better in certain circumstances than others. To "smush" really means to try many different image reduction algorithms and figure out which one gives the best result. These are the algorithms currently in use:
  1. ImageMagick: to identify the image type and to convert GIF files to PNG files.
  2. pngcrush: to strip unneeded chunks from PNGs. We are also experimenting with other PNG reduction tools such as pngout, optipng, pngrewrite. Hopefully these tools will provide improved optimization of PNG files.
  3. jpegtran: to strip all metadata from JPEGs (currently disabled) and try progressive JPEGs.
  4. gifsicle: to optimize GIF animations by stripping repeating pixels in different frames.

More Info and Resources

The Base 64 Alphabet

     Value Encoding  Value Encoding  Value Encoding  Value Encoding
         0 A            17 R            34 i            51 z
         1 B            18 S            35 j            52 0
         2 C            19 T            36 k            53 1
         3 D            20 U            37 l            54 2
         4 E            21 V            38 m            55 3
         5 F            22 W            39 n            56 4
         6 G            23 X            40 o            57 5
         7 H            24 Y            41 p            58 6
         8 I            25 Z            42 q            59 7
         9 J            26 a            43 r            60 8
        10 K            27 b            44 s            61 9
        11 L            28 c            45 t            62 +
        12 M            29 d            46 u            63 /
        13 N            30 e            47 v
        14 O            31 f            48 w         (pad) =
        15 P            32 g            49 x
        16 Q            33 h            50 y

RFC's

  • RFC 1866 - Hypertext Markup Language - 2.0
  • RFC 2045 - Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies
  • RFC 2046 - Definition of media types
  • RFC 2077 - Model top-level media type
  • RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax
  • RFC 2397 - The "data" URL scheme
  • RFC 3023 - Media types based on XML
  • RFC 4648 - The Base16, Base32, and Base64 Data Encodings
  • RFC 6657 - Update to MIME regarding "charset" Parameter Handling in Textual Media Types
  • RFC 5988 - Web Linking

W3 / IANA Docs

Microsoft Developers

Mozilla Developer Docs

Type image

image/gif
GIF image; Defined in RFC 2045 and RFC 2046
image/jpeg
JPEG JFIF image; Defined in RFC 2045 and RFC 2046
image/pjpeg
JPEG JFIF image; Associated with Internet Explorer; Listed in ms775147(v=vs.85) - Progressive JPEG, initiated before global browser support for progressive JPEGs (Microsoft and Firefox).
image/png
Portable Network Graphics; Registered, Defined in RFC 2083
image/svg+xml
SVG vector image; Defined in SVG Tiny 1.2 Specification Appendix M
image/tiff
Tag Image File Format (only for Baseline TIFF); Defined in RFC 3302
image/vnd.microsoft.icon
ICO image; Registered

Misc

convert image base64 encoder online tool

This page contains content from article and is released under the CC-BY-SA.


 

 

Comments