4

Suppose we have an adaptive icon like this:

<adaptive-icon
  xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/ic_launcher_background" />
    <foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>

How can we convert it to png format in a bash script?

My initial solution is: write a java program (like this) and use android SDK to convert to png and run the java in the bash. But is there a simpler solution? (as this requires android sdk to run)

Saleh
  • 1,819
  • 1
  • 17
  • 44
  • Your problem is that while `ic_launcher_foreground` probably should be a PNG, `ic_launcher_background` might not be. The actual launcher icon itself will have a shape dictated by the device that it is running on (square, circle, squircle, etc.). IMHO, a `bash` script seems like an unlikely tool for handling those complexities. You would not necessarily need the Android SDK (nor would it help you for a command-line tool), but you would need to parse the XML, examine the foreground/background resources, and make rendering decisions based on what you find. – CommonsWare Sep 17 '21 at 11:21

0 Answers0