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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:31:54+00:00 2026-06-16T05:31:54+00:00

I have two images. First ( avatar ) is 640×640, second ( like )

  • 0

I have two images. First (avatar) is 640×640, second (like) is 21×20.
When I’m trying to draw second on first, I get it, but with very low quality.
Here is the code:

var bounds = targeImageView.Bounds;
CGImageAlphaInfo alphaInfo = CGImageAlphaInfo.PremultipliedLast;
CGColorSpace colorSpaceInfo = CGColorSpace.CreateDeviceRGB ();
CGBitmapContext resultBitmap = new CGBitmapContext (IntPtr.Zero, (int)bounds.Width, (int)bounds.Height, 8, 4 * (int)bounds.Width, colorSpaceInfo, alphaInfo);
resultBitmap.DrawImage (bounds, avatar.CGImage);
var likeY = 0;
var likeX = 0;
var likeHeight = (float)Math.Floor (bounds.Height / 2);
var likeWidth = likeHeight;
resultBitmap.DrawImage (new RectangleF (likeX, likeY, likeWidth, likeHeight), like.CGImage);
targetImageView.Image = UIImage.FromImage (resultBitmap.ToImage ());

Here is the avatar picture on the same image view but without upper code, just imageView.Image = avatar;

avatar

Here is the same but after drawing.

enter image description here

  • 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-16T05:31:55+00:00Added an answer on June 16, 2026 at 5:31 am

    You got better eyesight than me – at least at that small size. If it’s a retina issue (I think so) then the following code should help you as it creates a context that will adjust itself to a retina (or not) display.

    UIImage avatar = ...;
    UIImage like = ...;
    UIGraphics.BeginImageContextWithOptions (avatar.Size, false, 0);
    using (CGContext ctx = UIGraphics.GetCurrentContext ()) {
        var rect = new RectangleF (Point.Empty, avatar.Size);
        avatar.Draw (rect);
        // coordinates are likely reversed (UIKit wrt CoreGraphics) you might have to fix them (untried)
        rect = new RectangleF (0, avatar.Height / 2, avatar.Width / 2, avatar.Height / 2);
        like.Draw (rect);
    
        targetImageView.Image = UIGraphics.GetImageFromCurrentImageContext ();
        UIGraphics.EndImageContext ();
        // dispose of avatar and like UIImage if not used anymore
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two images. I would like for the second image to fade-in when
I'm using jQuery validation plugin. I have two images: first background of label, when
I have image Array with two images out of that first image its showing
I have two images which i would like to compare and do different operations
I have two images that are of same size and text but different colors
I have two images on a page. The first image has position:relative and the
At my site on the first page i have two images put together so
I have two images. The first one is of background noise + content, and
I have one application in which I have two images. The first image is
I am trying to have two images on tp of each other. I can

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.