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

  • Home
  • SEARCH
  • 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 7071923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:44:46+00:00 2026-05-28T05:44:46+00:00

How can I create a UIImage from scratch. Specifically, I want to create a

  • 0

How can I create a UIImage from scratch. Specifically, I want to create a UIImage of size 320×50. Then, I’d like to be able to draw polygons of specific color onto that image.

  • 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-05-28T05:44:46+00:00Added an answer on May 28, 2026 at 5:44 am

    Here is an answer for you stitch picture in iphone

    And base on my experience, I can give you some note:

    Propotional scale

    - (UIImage *)scaleImage:(UIImage *)image toScale:(float)scaleSize
    {
     UIGraphicsBeginImageContext(CGSizeMake(image.size.width*scaleSize,image.size.height*scaleSize);
     [image drawInRect:CGRectMake(0, 0, image.size.width * scaleSize, image.size.height *scaleSize)];
     UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
     UIGraphicsEndImageContext();
     return scaledImage;
    }
    

    Resize

    - (UIImage *)reSizeImage:(UIImage *)image toSize:(CGSize)reSize
    {
     UIGraphicsBeginImageContext(CGSizeMake(reSize.width, reSize.height));
     [image drawInRect:CGRectMake(0, 0, reSize.width, reSize.height)];
     UIImage *reSizeImage = UIGraphicsGetImageFromCurrentImageContext();
     UIGraphicsEndImageContext();
     return reSizeImage;
    }
    

    Handle specific view

    You hava to import QuzrtzCore.framework first

    -(UIImage*)captureView:(UIView *)theView
    {
     CGRect rect = theView.frame; 
     UIGraphicsBeginImageContext(rect.size); 
     CGContextRef context = UIGraphicsGetCurrentContext(); 
     [theView.layer renderInContext:context]; 
     UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); 
     UIGraphicsEndImageContext(); 
     return img;
    }
    

    Handle a range form image

    CGRect captureRect = yourRect
    CGRect viewRect = self.view.frame;
    UIImage *viewImg;
    UIImage *captureImg;
    
    UIGraphicsBeginImageContext(viewRect.size); 
    CGContextRef context = UIGraphicsGetCurrentContext(); 
    [self.view.layer renderInContext:context]; 
    viewImg = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext();
    
    captureImg = [UIImage imageWithCGImage:CGImageCreateWithImageInRect(viewImg.CGImage, captureRect)];
    

    Save the image

    Save in app

    NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"image.png"];
    [UIImagePNGRepresentation(image) writeToFile:path atomically:YES];
    

    Save in album

    CGImageRef screen = UIGetScreenImage();
    UIImage* image = [UIImage imageWithCGImage:screen];
    CGImageRelease(screen);
    UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create a context from an UIImage, and then I draw into it with
I'd like to generate a thumbnail UIImage from an MKMapView I create. Unfortunately map
I can create UIImage from NSData using [UIImage imageWithData:] or [UIImage initWithData:] methods. I
I am trying to create a TIFF image from a UIImage . I looked
How can I programmatically create a video file from a bunch of UIImages? I
I'm using CGDataProviderCreateWithData to (eventually) create a UIImage from a malloced array of bytes.
I'm using the well-known pattern to create an UIImage from an UIView : +
I can use the following code to create image from UIView. However the same
I want to create an image of fixed size e.g. 612 by 612. I
I can create a menu item in the Windows Explorer context menu by adding

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.