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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:47:55+00:00 2026-05-15T01:47:55+00:00

I have two png image files that I would like my android app to

  • 0

I have two png image files that I would like my android app to combine programmatically into one png image file and am wondering if it is possible to do so? if so, what I would like to do is just overlay them on each other to create one file.

the idea behind this is that I have a handful of png files, some with a portion of the image on the left with the rest transparent and the others with an image on the right and the rest transparent. and based on user input it will combine the two to make one file to display. (and i cant just display the two images side by side, they need to be one file)

is this possible to do programmatically in android and how so?

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

    I’ve been trying to figure this out for a little while now.

    Here’s (essentially) the code I used to make it work.

    // Get your images from their files
    Bitmap bottomImage = BitmapFactory.decodeFile("myFirstPNG.png");
    Bitmap topImage = BitmapFactory.decodeFile("myOtherPNG.png");
    
    // As described by Steve Pomeroy in a previous comment, 
    // use the canvas to combine them.
    // Start with the first in the constructor..
    Canvas comboImage = new Canvas(bottomImage);
    // Then draw the second on top of that
    comboImage.drawBitmap(topImage, 0f, 0f, null);
    
    // comboImage is now a composite of the two. 
    
    // To write the file out to the SDCard:
    OutputStream os = null;
    try {
        os = new FileOutputStream("/sdcard/DCIM/Camera/" + "myNewFileName.png");
        comboImage.compress(CompressFormat.PNG, 50, os)
    } catch(IOException e) {
        e.printStackTrace();
    }
    

    EDIT :

    there was a typo,
    So, I’ve changed

    image.compress(CompressFormat.PNG, 50, os)

    to

    bottomImage.compress(CompressFormat.PNG, 50, os)

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

Sidebar

Related Questions

I have two grayscale Png files( https://i.stack.imgur.com/8RGh4.jpg ) that I want consider as a
I have two files and the content is as follows: alt text http://img144.imageshack.us/img144/4423/screencapture2b.png alt
I have a script that runs to upload an image, then resize it into
I have three images that I would like to join in a widget I'm
I have a basic png file with two colors in it, green and magenta.
In my program, I have a web application that creates a PNG image. This
I do have some image files(.png files) in document directory(iPhone). I am viewing web
Okay so I have two png files, a circle and a maze. Basically the
I have two CSS rules following each other: .some td:first-child:before { content:url('path/to/image.png') ; }
I have two layers being drawn. A static background texture and a texture(png) with

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.