title: Crop square image to circle - Programmatically
body: <p>i was searching for past one day and i was not successful .</p>
  
  <p>i get the image from API , and i download it to a bitmap file using the following code .</p>
  
  <pre><code>private Bitmap DownloadImage(String URL) 
      {
          Bitmap bitmap = null;
          InputStream in = null;
          try 
          {
              in = OpenHttpConnection(URL);
              bitmap = BitmapFactory.decodeStream(in);
              in.close();
          }
          catch (IOException e1) 
          {
              e1.printStackTrace();
          }
          return bitmap;
      }
  
      private InputStream OpenHttpConnection(String urlString) throws IOException 
      {
          InputStream in = null;
          int response = -1;
  
          URL url = new URL(urlString);
          URLConnection conn = url.openConnection();
  
          if (!(conn instanceof HttpURLConnection))
              throw new IOException("Not an HTTP connection");
  
          try 
          {
              HttpURLConnection httpConn = (HttpURLConnection) conn;
              httpConn.setAllowUserInteraction(false);
              httpConn.setInstanceFollowRedirects(true);
              httpConn.setRequestMethod("GET");
              httpConn.connect();
  
              response = httpConn.getResponseCode();
              if (response == HttpURLConnection.HTTP_OK) 
              {
                  in = httpConn.getInputStream();
              }
          }
          catch (Exception ex) 
          {
              throw new IOException("Error connecting");
          }
          return in;
      }
  </code></pre>
  
  <p>And i get the image as a square and i want to crop the four corners and make it to circular image . Is there any possible way to achieve ?</p>
  
  <p>Any related answers are welcomed . Thanks in advance .</p>