Posted in html
7493
6:20 am, August 31, 2018
 

copy image to data uri using chrome base64 encode

Update: 26 Aug 2020 - Fixed video and original image link all should be working now in chrome.

Found this one useful if you want to convert an image to base64 encode and link it directly in css or html, rather than using a base64 encoder.

  1. find the image you want to convert
  2. lets use this emoji as an example. 
  3. open dev tools, f12 and inspect the image.
  4. right click the image and open in sources panel
  5. right click the image in sources panel and press copy image as datauri
  6. this will give you the image as a converted string, like this:
  7. then you can use it like this in an image tag:
  8. or you can even add it to css as a background image tag

as this one is a bit hard to follow, here is a video of how to do it.

View post on imgur.com

HTML

<img src="data:image/gif;base64,R0lGODlhKgAWANU1AKul8/3y/YmN7ZaQ6fX+/4OF4u34+ABs/wLap3ZSo34svfyjqJBBzPZsgEgWbJKM5dDI6W4jpqVb3lkchpGQ6IU0wlAZeHonufJs97ue6dLR676X1uan3tK86wrl/5OO4tnn+v3F36SF0v3a3/vQ3nl83T7+/3yA4ZOH3dvp+/L//Pju7uv8+On39/P09Zd4xv/j/+G7/UEHbUtJr////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vb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MKt3V8ZIMwMQkOwbMPDwJ1MxiZg27NVDMPA9EY3m0AoYkzBQPcAhiBgQIziUTk5ecC8+3u7/DmFGX2RmT7UUEAACH5BAkAADUALAAAAAAqABYAAAaxwJpwSCwaj8ikcslsOp/QqHRKrVqjsmz2yszOvt8t9yj7xs7n8LhYBsRggQBtHpvJ1kMZAACDy+c0MXd4bW9+gHMzhAx6MR0zEHGIdWMyDBJ6HDMwM3FyGjMZdlwyERUyIg0LfX4BnTMJE4NVMgoXMgIbaaysCw0Ws7QKMg8CbmCbMGcJDsG0Mw8DxgAYGGgAM814MwUD0tN7AAKjeDXc3d8C6orlQ18F6BRf7UbI7FFBACH5BAUAADUALAAAAAAqABYAAAaowJpwSCwaj8ikcslsOp/QqHRKrVqvWKZsu80qt7FwuOstygAxWCBAa8dk5eEZAFOz27R3vHZO2/FtM3EyAmh1a3ducFkyDH1+iHgxM4tWjRKEHzMdhwEQMxCTE5VUMhEVMiIzk3V1MzAzHDMWpFMyChcyDQtoYa0wCw0JDrW2CjIoA4UAM81hAMPFpTMFA8rLANkClHvU1dcC4YJ7Qs0F3xTN5EXN7VNBACH5BAkAADUALAwACwASAAgAAAY/wFptJiwahbKjcmmcAZhFGUM4cZZmGVgRMoMEZJKpxUmOFWewWUhWidQcicZCsFw0ZBeFEP44C801GzJ6UIVBACH5BAUAADUALAAAAAAqABYAAAaWwJpwSCwaj8ikcslsOp/QqHRKrVqjsmz2yszOvt8t9yj7FsPjYjk5k6Xf0hkgBoMFArR8vv2eCeZ1dxAzGnkyDG5cZR8zGXR2MwEzIzQyEohcEwl+M492AQsNJDIVEYlWFg0LfzGPM3UhMDIXCqdVDgknD39gdXUxMrVjMg4zDwN/c62tAHxpZQUDyMkA1QIzcNna21dBADs=" />

View Statistics
This Week
237
This Month
849
This Year
1881

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Items in html
font awesome spinner loader loading spinner Using the HTML tag details for easy accordions Video different sources on screen sizes video embed html responsive Boots Widget change from widget to cat head and click function pulse map dots codemirror with auto preview window using figcaption and figure for your images a google font like muli - mulish and embed code basic radio checklist - check and item and get its value in a textarea share to twitter html link only linked in share link html only, linkedin, linked-in Facebook HTML for Sharing a Link Footer Design and Redesign Regions of New Zealand - In Dropdown Form content editable p tag with spell check enabled get directions from google maps form embed Common and Uncommon Meta Tag's and Social Meta Tags Input Suggestions using a datalist Add custom symbol to ul li list and align text items using the kbd html tag twitter social sharing meta tags test image url that always changes unsplash placeholder set the amount of lines to show in a textarea field Scroll down indicator css javascript and html a page with two images Aligning Images in TinyMCE or Floating them left and right (code) test page for the custom css 12 grid used on this site easy twitter embed code Custom JS Tabs - No Jquery or Jquery UI scroll to top html css and js hide parts of a form until the 1st item is selected load a youtube video in a fancybox modal add google captcha to enable and disable a form button template for testing and live reloading html files toggle div function with chevron up down toggle Bootstrap Card Formatting HTML and CSS - Header and Footer Applied Accessibility - Tab Index Applied Accessibility - Access Keys Dropdown Box with Searchable Text meta keywords tag meta description tag favicon code meta tag foundation includes cdnjs Form elements New Zealand region list video embed no controls video embed tag video embed full screen all screen sizes del youtube embed iframe take full page screenshot screencapture using chrome dev tools
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
Be Yourself, Back Yourself
Kristie Bennett, Survivor
Random CSS Property

:empty

The :empty CSS pseudo-class represents any element that has no children. Children can be either element nodes or text (including whitespace). Comments, processing instructions, and CSS content do not affect whether an element is considered empty.
:empty css reference