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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:33:57+00:00 2026-06-04T13:33:57+00:00

EDIT ANSWER: – (UIImage*) maskImage:(UIImageView *)maskImage withMask:(UIImageView *)cropImage { UIImage *image = nil; UIImage

  • 0

EDIT ANSWER:

- (UIImage*) maskImage:(UIImageView *)maskImage withMask:(UIImageView *)cropImage
{

    UIImage *image = nil;
    UIImage *imagePNG = nil;

    CGSize newImageSize = CGSizeMake(cropImage.frame.size.width, cropImage.frame.size.height);

    UIGraphicsBeginImageContextWithOptions(newImageSize, NO, 0.0); //retina res
    [self.viewForImg.layer renderInContext:UIGraphicsGetCurrentContext()];

    image = UIGraphicsGetImageFromCurrentImageContext();


    NSData *imgData =  UIImagePNGRepresentation ( image ); // get PNG representation
    imagePNG = [UIImage imageWithData:imgData]; // wrap UIImage around PNG representation
    UIGraphicsEndImageContext(); 
    return imagePNG;
}

i tried to screenshots my iphone screen to save a picture into my camera roll.
but encountered this error. anybody know if there is an issues with my code ?

May 22 14:13:34 unknown assetsd[281] <Error>: ImageIO: CGImageDestinationAddImage image parameter is nil
May 22 14:13:34 unknown assetsd[281] <Error>: ImageIO: CGImageDestinationFinalize image destination does not have enough images
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextTranslateCTM: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextScaleCTM: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextSetBaseCTM: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextSaveGState: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextSetInterpolationQuality: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextTranslateCTM: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextScaleCTM: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextSetFillColorWithColor: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextFillRects: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextTranslateCTM: invalid context 0x0
May 22 14:13:34 unknown assetsd[281] <Error>: CGContextScaleCTM: invalid context 0x0

code:

- (IBAction)saveImage:(id)sender {

    self.imageOverlay.alpha = 1;
    self.savedImage = [self maskImage:self.imgView withMask:self.baseImgView];

    UIImageWriteToSavedPhotosAlbum(self.savedImage, self, @selector(imageSavedToPhotosAlbum: didFinishSavingWithError: contextInfo:), nil);
}


- (UIImage*) maskImage:(UIImageView *)maskImage withMask:(UIImageView *)cropImage
{

    UIImage *image = nil;
    UIImage *imagePNG = nil;

    CGSize newImageSize = CGSizeMake(cropImage.frame.size.width, cropImage.frame.size.height);

    UIGraphicsBeginImageContextWithOptions(newImageSize, NO, 0.0); //retina res
    [self.viewForImg.layer renderInContext:UIGraphicsGetCurrentContext()];

    image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext(); 

    NSData *imgData =  UIImagePNGRepresentation ( image ); // get PNG representation
    imagePNG = [UIImage imageWithData:imgData]; // wrap UIImage around PNG representation

    return imagePNG;
}
  • 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-04T13:33:59+00:00Added an answer on June 4, 2026 at 1:33 pm

    This could happen if the CGSize you’re passing to UIGraphicsBeginImageContextWithOptions is CGSizeZero. I suppose the cropImage argument is either nil or its size is CGSizeZero. Please debug and make sure you have all objects initialized and with correct frames.

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

Sidebar

Related Questions

EDIT : Accepted answer points out what my issue was. I added another answer
[Edit] I've summarized the answer to the following below, the error lies in the
[EDIT] I am NOT accepting any answer which involves BigInteger, or other similarly inefficient
Answer solved in edit below I had this piece of code Dictionary<Merchant, int> remaingCards
Edit: Building off of aL3xa's answer below, I've modified his syntax below. Not perfect,
[EDIT: Problem solved. Please see my answer below.] In my app I call the
Edit: For a detailed how-to, check out my answer . I'm struggling with it
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
Can I intercept a method call in Objective-C? How? Edit: Mark Powell 's answer
EDIT: ANSWER AT BOTTOM OF THIS QUESTION Okay so I've got some generic EF

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.