Start a new topic

get base64 for icons from library

I'd like to use the device API to update the icon on my clock face.


I have the icons in the library, but

https://lametric:4343/api/v2/device/apps/com.lametric.clock/widgets/clock.clockface/actions

requires a base64 encoding of the image.


What is the best way to get the base64?


Thanks

Chris




2 people have this question

BTW: Updating just the icon at the clock face using icon ID is currently possible via IFTTT triggers, but they become way too expensive for such a simple thing.

So I am wondering how IFTTT can do it, but it's not possible via API.

I als want this, and dom’t want to pay for IFTT. Want to steer this with my Homey

Hi guys!


If you want to get base64 code please try the next steps:


1)Save your icon in .png format (it looks like this one: https://developer.lametric.com/content/apps/icon_thumbs/31786.png );
3)Drag and drop it in the needed field;
4)When you see your icon loaded, tap 'Convert to Base64!';
5)Copy all code (plese note that it should start like this data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAAC...)
6)Paste this code in your app frame in icon line


 ("icon": "<icon id or base64 encoded data>")


7)Save all changes


 We hope this helps. If you have any other questions, please drop an email on support@lametric.com.


Best wishes,

LaMetric Team

Hi,


Thanks for the guide but do you still plan to allow the use of IDs instead of base64? When interacting with a widget?


1 person likes this

+1 for the IDs option in addition to base64 please !

How can you convert a icon from the libary to png, to be able to get the bade64 code? Why not implement the iconcodes?

Now I know how to make a Base64, I don't know yet how to download an image out of the LaMetric icons in a 8x8 png format. Simply copy and save does not give an 8x8 but a much higher resolution. Please help!!

Hi!


Please find the link to our documentation - https://lametric-documentation.readthedocs.io/en/latest/reference-docs/cloud-icons.html on how to download the original icon in 8x8 format.
Also, you may use this URL https://developer.lametric.com/content/apps/icon_thumbs/5588.gif (as example) to download icons in the original format. 

We hope this will be helpful. If you have other questions please drop an email on support@lametric.com.

With the URL it works indeed, only change the last  part of the URL (5588.gif) into the desired xxxx.png 

And then convert it to base 64 https://www.browserling.com/tools/image-to-base64;


and now add in front of the base 64 code:  

data:image/png;base64,


Thank you

Login or Signup to post a comment