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

The Archive Base Latest Questions

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

I need to combine 2 images into one. Basically all i need to do

  • 0

I need to combine 2 images into one. Basically all i need to do is to overlay one of them on top of the other in the center of the image. This needs to work on all major android devices.

I have tried a number of things, but here is my code snippet as of right now (and yes I know it’s messed up, we need to figure out delx and dely):

/* Rotate our original photo */
//  final float scale = getResources().getDisplayMetrics().density;
    canvas.drawBitmap(bmp, 0f, 0f, null);
    final float overlay_scale_factor = .5f;
    final int overlaywidth = (int)(overlay.getWidth() * overlay_scale_factor);
    final int overlayheight = (int)(overlay.getHeight() * overlay_scale_factor);
    final int delx = overlaywidth;
    final int dely = overlayheight;
    Matrix mat = new Matrix();
    mat.postRotate(270);
    mat.postScale(overlay_scale_factor, overlay_scale_factor);
    //mat.postTranslate(-delx, -dely);
    canvas.drawBitmap(overlay, mat, null);
    /* Bottom image 'composite' is now a composite of the two. */

Any help is appreciated. I know this is just math, but I’m not good at this kind of stuff.

The first image, ‘bmp’ is 100% the size of the canvas.
The second image, ‘overlay’ is the overlay that needs to be centered after it’s rotated 270 degrees.

  • 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-28T01:28:44+00:00Added an answer on May 28, 2026 at 1:28 am

    Totally untested, but I’d expect something like this to work:

    // Set the origin (0,0) in the middle of the view
    canvas.translate(width/2, height/2);
    
    // Draw the first bitmap so it is centered at (0,0)
    canvas.drawBitmap(bmp, -bmp.getWidth()/2, -bmp.getHeight()/2, null);
    
    // Rotate & scale
    canvas.save();
    canvas.rotate(270);
    canvas.scale(.5f);
    
    // Draw the overlay
    canvas.drawBitmap(overlay, -overlay.getWidth()/2, -overlay.getHeight()/2, null);
    canvas.restore();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We all know CSS sprites - a method to combine multiple images into one
I have 3 byte arrays in C# that I need to combine into one.
I need to create and combine several expressions for child entity into one to
I need to work with many images, and I can't hold all of them
I have two images, one background image (img_back.png) and other is an image (person.jpg),
i need to create a transparent image, then combine transparent pngs to it whilst
I have many base images that I need to combine to construct larger images
I have the following JQuery libraries and I need to combine them in order
I have the following three SQL queries. I would like to combine them into
Can I club together three images to form a one with CSS? Basically, I

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.