title: How to Save a PictureDrawable as a JPEG/PNG file in Android
body: <p>I have PictureDrawable that I wish to save as an image (JPEG/PNG) but I can't seem to find any information how to go about this.</p>
  
  <p>I tried this but it does not seem to work</p>
  
  <pre><code>PictureDrawable myDrawable = GetPictureDrawable(); 
  Bitmap bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
  myDrawable.draw(new Canvas(bitmap));
  bitmap.compress(CompressFormat.JPEG, 100,  new FileOutputStream("/MyLocation/MyImage.jpg"));
  </code></pre>
  
  <p>What am I doing wrongly?</p>