Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9053555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:27:11+00:00 2026-06-16T13:27:11+00:00

I am just testing the following code to round corners on UIImage: – (UIImage

  • 0

I am just testing the following code to round corners on UIImage:

- (UIImage *)makeRoundedImage:(UIImage *)image radius:(float)radius;
{
    CALayer *imageLayer = [CALayer layer];
    imageLayer.frame = CGRectMake(0, 0, image.size.width, image.size.height);
    imageLayer.contents = (id) image.CGImage;

    imageLayer.masksToBounds = YES;
    imageLayer.cornerRadius = radius;

    UIGraphicsBeginImageContext(image.size);
    [imageLayer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return roundedImage;
}

I looks fine unless you look closely to generated image. Corners are not smooth. How can I make corners to be smoother/softer ?

EDIT:

Processed image with rounded corners in quartz:

enter image description here

Like you can see corner is not smooth.

This is version with UIImageView’s cornerRadius that is much more smoother.

enter image description here

Where is the catch ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:27:12+00:00Added an answer on June 16, 2026 at 1:27 pm

    Here is UIImage category:

    - (UIImage *) imageWithRoundedCornersRadius: (float) radius
    {
        // Begin a new image that will be the new image with the rounded corners
        UIGraphicsBeginImageContextWithOptions(self.size, NO, 0);
    
        // Add a clip before drawing anything, in the shape of an rounded rect
        CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height);
        [[UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:radius] addClip];
    
        // Draw your image
        [self drawInRect:rect];
    
        // Get the image, here setting the UIImageView image
        UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext();
    
        // Lets forget about that we were drawing
        UIGraphicsEndImageContext();
    
        return roundedImage;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just tried the following code snippet for shellcode testing purposes:- #include<iostream> using namespace
I'm using c# 4.0 and a console application just for testing, the following code
just for testing i had created the following code: #include<stdio.h> int main(){ char *p
I was testing the following code from one of my previous questions (turning a
I have the following code #if defined(TESTING) #define TEST_FAILED_IN_VMC(...) TestFailed(__FILE__, __LINE__, __VA_ARGS__) #define TEST_FAILED_IN_UNIT_TEST(...)
I have been using the following code for quite some testing now and havent
I'm using following code (purely for testing purposes): $(window).bind('unload', function() {alert('unload!')}); $(window).unload(function () {alert(".unload()")});
If one runs the following code in java: public class Testing { public static
I write a piece of code just for testing to send txt file with
I am having a problem testing blackjack java code, this is the following code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.