Today I explored about custom ribbon action to set the Custom Image to Ribbon button and that there absolutely awesome! I was creating a Custom Action in my SharePoint Hosted app. I wanted to add a Button into the Ribbon of any Custom List to my App Web and do some work based on List Information. I started by adding a Custom Ribbon Action.
New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features



You can see the below code snippet of elements.xml of ribbon custom action which will generate for you based on your settings selected in the wizard.

Have a look at the highlighted code in the previous block you will notice that the icon of the button is a placeholder you have the ability to change. The next screenshot show the button with the placeholder icon:

Read some SharePoint 2013 tutorials below:
- Bind SharePoint list items to dropdownlist using Rest api and jQuery in SharePoint 2013
- SharePoint 2013 Get current login User Profile Properties through REST API
- Upload large files to SharePoint online document library using PowerShell csom
Solution:
A better workaround is to use Data URIs which is a way of embedding the actual image data in the src attribute of the img tag. The only limitation is browser support for example
The code after applying this workaround will be like this:
Custom Ribbon Action and set the Customize Icon to Ribbon button in a SharePoint Hosted AppFinal Output Customize Icon to Ribbon button

Note: There are a lot of image data URI generators online like this one.