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 8407463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:22:17+00:00 2026-06-09T23:22:17+00:00

I am trying to crop an image using this rectangle.But Not getting how to

  • 0

Rectangle used to crop

I am trying to crop an image using this rectangle.But Not getting how to stretch the rectangle.I am having one UIView that is outside and within that other view shown with black border. When I stretch DO i need to change the frame for both UIViews ??

should use Pinchgesture to stretch the rectangle or any other method??

Here four blue handlers are UIView s. How will i determine the dragging of them??
If there please suggest.

  • 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-09T23:22:18+00:00Added an answer on June 9, 2026 at 11:22 pm

    Following code for the selecting the box and cropping the image.

    -(IBAction) cropImage:(id) sender{
        // Create rectangle that represents a cropped image  
        // from the middle of the existing image
    float xCo,yCo;
    float width=bottomCornerPoint.x-topCornerPoint.x;
    float height=bottomCornerPoint.y-topCornerPoint.y;
    if(width<0)
    width=-width;
    if(height<0)
        height=-height;
             if(topCornerPoint.x <bottomCornerPoint.x)
             {
                   xCo=topCornerPoint.x;
              }
             else 
             {
                 xCo=bottomCornerPoint.x;
             } 
            if(topCornerPoint.y <bottomCornerPoint.y)
            {
                 yCo=topCornerPoint.y;
             }
          else {
                 yCo=bottomCornerPoint.y;
           }
        CGRect rect = CGRectMake(xCo,yCo,width,height);
        // Create bitmap image from original image data,
        // using rectangle to specify desired crop area
        UIImage *image = [UIImage imageNamed:@"abc.png"];
        CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], rect);
        UIImage *img = [UIImage imageWithCGImage:imageRef]; 
        CGImageRelease(imageRef);
        // Create and show the new image from bitmap data
        imageView = [[UIImageView alloc] initWithImage:img];
        [imageView setFrame:CGRectMake(110, 600, width, height)];
        imageView.image=img;
        [[self view] addSubview:imageView];
        [imageView release];
    }
    

    Hope this may helping to lot

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to crop an image using CAShapeLayer with this code CALayer* contentLayer
I'm simply trying to crop a JPEG image (no scaling) using PHP. Here is
I'm trying to develop image crop using JQuery. I use ajax to upload the
I am trying to crop the image using JQuery Jcrop plugin with Java Stuff,
i am trying to crop a gif image using the libMagick.so library. ./convert --version
I am trying to crop and image using PHP and the GD library and
I am trying to crop an image from an url and then stretch the
I am trying to crop a (non background) image then scale that cropped image
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
I am trying to reuse a framelayout that has an image and textview inside

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.