1. Строка в растровое изображение
String content = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAABGdBTUEAALGPC/xhBQAABURJREFUWAnNWFtMXFUU3XcKBHBmiMZERRmIAuqXtcbE1A/7EDE24iPGxGj88MtHP/TDRzR8gYmPRP1Sv4lKYpqgxBqFWtuAVNJE/VIrmMBAWySNAjMF5HHHte6cPTlzZi4MUxrZyWHvsx9rL849986515PypAJlUYwaDNo6YMqaNZZgp80c6vJIBLBXYiTa29v3DA0NvTAzM/PZwsLCyeXl5TPr6+spDtr0McYc5rLG1BJj28QDUhzjxsHBwWfQ9ITv+6uZEoW5rGEtMQwWMS9JKlHd2NPT82gqlTpVIpfQNGIQi5gYxC5LauLxeEsymfwotFOZAWISG6y4R7ck8ba2tt1zc3PHyuy9aRmx2QOsuE0KpNi1rkHBzf39/b3V1dW3FFQYx9g/Il//mZGB6YxMXszIFO+/jEhDrUjTFZ603eDJAzd50sLbJURwo/ze0dHxBPbfGaQQIScusUoscROXuq6u7mAuyzJ+/kvkjRFfvjnvZ72KAFLi2vDdf11E3twbkduvsUAsc35+/rtEIvEcbpAJuFc1pFCc006A1GsNDQ3PaoLqdTR59YQv7/+WwcKQReniAfqlWz15e19EdtkdDcTU1NTHIPcWpkmMANx+rsRwx9xRjNTcvyKHvvDlvV99webJlrI8bLChxmiihrXEIJYr7Mne8Mc0pvxJsAm386fRaPQuDVJzpQ71+TKgl84OlmHfh0t79JHClUun0z/GYrEnATmB4euK1WED7nNJse/L34PUOewnXYFL1MQipivsTQ7w1zGmK5bA5usB43voVPkJG/3OI+uS8ckGwmyatqbf9emcMYop1zov4snpx3bJHueGwBU7iZvvaVQkuWIV+D27GozvJoYtrw9jTykpBrSBrW3bzWFM41aMmMR2hRzIBf4KEot2dnbu9TyPJ4Sc/PG3yMBZU6wNVDOrmK0+W9u56oeP2HwW2kIO5AJflMRqWltbC1brKB6egRiVnZi/ts+285KK5Grc1Hw1Xljc3NxMLjXBpcQTvl5rVA8kUcS6yziCHtrQ6NraWnIJLmVFVVXVtU5cJtOGGAMkR7FJ6ly1nUMfxfU59ZMpTcim86/hUhGcPCsrKwtWbPqiSdZa1Yqhc9X0q606zGf804s08sVwCVaMERsqm1noyUfYhpmnD6t8rKAz99ja6urq+fyYyPU4JeRdOqZv86ivdrviVzzLZS0gtrKyMuOmNMasf0dXz9a2zWJ7rraC6tzWsPN6mFzDJUtscXHxrGKobkuAGIFsMAZ1btvqU60xztXnaoSCHsy1xHAJiC2Nj4+PWLHAfLDZIUavNrJ1mN/NKZLX0WJdFcYhY2NjP0At8VKmu7q6RnA04ftgTlqvEjnYwDBEm2Rn+X8Z20yK1BPbPd2SQ3d39ynApZVy+I/4J/gR5xlsGwU/PXL6qc1/xNkyNTo62uP25q//4dsMd5ebO9di2x9iE9M9WbDccEjR1hXjNQs9KLZ/7svxZOFpgABblQOJiHz7eOkHRXa90NfX967biGf0Iw9HZD8Ac3uNK6GDBboy6rPnGoePGMQqdu43vS8gPVgBXTGW097wZeTFY758+AteRba457innt/tyQf3FidV7GXEJkZym76+8VT7Co7GxydLu7QHGiPyzv5I0T3FhqW8vjGPUtILLw+SX45lZHAiI8mFjJzjxyZIPT5OJeJ44W3y5CE8p/jYCZONXnjDav73TwRhxOjfkR9VlDA/Fe24z1BKjjfIjvtwp+So+RDOfeocHh4+PDs724v30bBPnb3MKfdTp/u4sIlsZPNIflk/Dv8H0I4Y2Oy/OicAAAAASUVORK5CYII=";
try {
byte [] encodeByte=Base64.decode(content ,Base64.DEFAULT);
Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
return bitmap;
} catch(Exception e) {
e.getMessage();
return null;
}
2. Битовая карта в строку
public String BitMapToString(Bitmap bitmap){
ByteArrayOutputStream baos=new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG,100, baos);
byte [] b=baos.toByteArray();
String temp=Base64.encodeToString(b, Base64.DEFAULT);
return temp;
}