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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:12:29+00:00 2026-06-18T07:12:29+00:00

I´m trying to merge 2 images, one is bitmap from camera, second one is

  • 0

I´m trying to merge 2 images, one is bitmap from camera, second one is .png file stored in drawables. What I did was that I used both images as bitmaps and I tried to merge them by using canvas, something like this:

Bitmap topImage = BitmapFactory.decodeFile("gui.png");
Bitmap bottomImage = BitmapFactory.decodeByteArray(arg0, 0, arg0.length);

Canvas canvas = new Canvas(bottomImage);
canvas.drawBitmap(topImage, 0, 0, null);

But I keep getting “Bitmap size exceeds VM budget” error all the time. I tried nearly everything, but still, it keeps throwing this error. Is there another way of merging 2 images? What i need to do is simple – I need to take photo and save it merged with that .PNG image stored in drawables. For example this app is very close to what i need – https://play.google.com/store/apps/details?id=com.hl2.hud&feature=search_result#?t=W251bGwsMSwyLDEsImNvbS5obDIuaHVkIl0.

Thanks 🙂

  • 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-18T07:12:31+00:00Added an answer on June 18, 2026 at 7:12 am

    See the below code for combining two images.
    This method returns combined bitmap

    public Bitmap combineImages(Bitmap frame, Bitmap image) {
            Bitmap cs = null;
            Bitmap rs = null;
    
            rs = Bitmap.createScaledBitmap(frame, image.getWidth() + 50,
                    image.getHeight() + 50, true);
    
            cs = Bitmap.createBitmap(rs.getWidth(), rs.getHeight(),
                    Bitmap.Config.RGB_565);
    
            Canvas comboImage = new Canvas(cs);
    
            comboImage.drawBitmap(image, 25, 25, null);
            comboImage.drawBitmap(rs, 0, 0, null);
            if (rs != null) {
                rs.recycle();
                rs = null;
            }
            Runtime.getRuntime().gc();
            return cs;
        }
    

    You can change height and width as per your requirements
    Hope this will help…

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

Sidebar

Related Questions

I am trying to merge the data from two tables into one result but
I'm trying to make a tool that takes jpeg images (4 images) from a
I am trying to merge 2 simple programs I have made to one .jar.
I'm trying to merge logs from several servers. Each log is a list of
I am trying to merge some code behind code for .net that I found
I'm trying to merge two arrays for the values of array1 that are set
i'm trying to get all the images from a facebook group using facebook API
I am trying to merge two d3.js examples into a single html file, which
I'm trying to merge specific commits from a branch into master, and push them
I'm looking to create a video using a set of png images that have

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.