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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:34:21+00:00 2026-05-15T17:34:21+00:00

I am designing an application where a user places multiple UIImageViews one over another.

  • 0

I am designing an application where a user places multiple UIImageViews one over another. When the user decides to save this to photo album, I have to combine all these UIImageViews and save it to Photo Library. While combining them I need to preserve their positions, resolutions, zorder. The approach I tried I was to have a parent UIView which acts like a container. The user places all the UIImageViews inside this UIView. While saving, I take a screenshot of the UIView and save it. Although this approach works, it does not preserve the resolution. The resolution of the final image is same as the resolution of the parent UIView size (width and height being 300 pixels). Is there way to preserve the resolution? or atleast have a higher resolution like upto 1024 x 768 pixels? Any pointers/code examples would be appreciated!

  • 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-15T17:34:22+00:00Added an answer on May 15, 2026 at 5:34 pm

    What you are doing, saving the UIView, is a very good idea if the size of the UIView is higher than the size of the biggest image you have, but that’s almost never the case.
    What you have to do is to create a Graphic Context (CGContextRef), as big as the biggest of your images, sort your images by z-order and start drawing those images there.
    I’ll try to help you with some pseudo code:

    -(UIImage *)mergeFlag{
    
    UIImage * mergedImage = nil;
    
    //In some pace you need to fill these values with the biggest width of all your images and the biggest height;
    int Max_Width;
    int Max_Height;
    
    //Use here your image with the biggest Z-order.
    CGImageRef image;
    
    size_t cWitdh = Max_Width;
    size_t cHeight = Max_Height;
    size_t bitsPerComponent = 8;//If 8 isn't right you should use CGImageGetBitsPerComponent(image) with some image.
    size_t bytesPerRow = 4 * Max_Width;// I use 4 assuming you have 8 Bits per component and you have 4 components (R,G,B,A) , if you have an image specifically, you can use CGImageGetBytesPerRow(image)
    
    //Now we build a Context with those dimensions.
    CGContextRef context = CGBitmapContextCreate(nil, cWitdh, cHeight, bitsPerComponent, bytesPerRow, CGColorSpaceCreateDeviceRGB(), CGImageGetBitmapInfo(image));
    
    //The code of this cycle is to ilustrate what you have to do:
    for(image in your Images ordered by z-Order)
    {
        //The location where you draw your image on the context is not always the same location you have in your UIView, 
        //this could change and you need to calculate that position according to the scale between you images real size, and the size of the UIImage being show on the UIView.
        CGContextDrawImage(context, CGRectMake(currentImage.frame.origin.x, currentImage.frame.origin.y, CGImageGetWidth(currentImage), CGImageGetHeight(currentImage), currentImage);
    }
    
    CGImageRef mergeResult  = CGBitmapContextCreateImage(context);
    mergedImage = [[UIImage alloc] initWithCGImage:tmp];
    CGContextRelease(context);
    CGImageRelease(mergeResult);
    return mergedImage;}
    

    Hope it helps.

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

Sidebar

Related Questions

I was just designing this application and made many .aspx files which have my
I am designing an application where I don't want the user to have to
I have been trying different techniques while designing this application, which to me is
Say you’re designing an application that, by requirement, allows a user the flexibility of
We are designing an online application (college admission form) which mandates the user to
I'm current designing a Rails application that uses a form for user login, then
I am designing the user interface of a web application but I am inexperienced
I'm designing my application data model and I have a doubt, whether to use
I am designing an application, one aspect of which is that it is supposed
I am designing an application where the user selects the option to update his

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.