# Image height based on battery percentage

I am trying to create a battery bar by using a rectangular image inside a battery image. I set the height to #BLP#*26 which should set the image to 26 pixels tall when it is 100% full and go down from there, but it simply creates the height identical to the battery level. 49% = 49 pixels tall. What am I missing here?

Ahhhh. parenthesisâ€¦

(#BLN#/4) got me 25 pixels at 100% which will do.

BLP#*26 didnâ€™t work though, still not sure why

1 Like

If I recall, then BLP is Battery Level Percentage, with a % at the end. Which I suppose is just a convenience for displaying text, as Iâ€™m assuming Facerâ€™s math processing gets confused by the â€ś%â€ť character (or wants to interpret it as modulo).
So all you really need to do is first get the percent with (#BLN#/100) and then multiply that by the max length of the bar, i.e., ((#BLN#/100)*26)

That would work! Thanks!
On a side note, I found with my gear s2, it hangs in the optimizing sage when I use the battery height formula. I switched to 20 images of different lengths that appear at the correct battery level and that seems to work just fine. Not quite as nice as the battery percentage, but i got tired of it hangingâ€¦

Does the same expression for phone battery life just by replacing the tag?