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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:59:22+00:00 2026-06-17T23:59:22+00:00

I tried this code: private void CreateAnimatedGif(string FileName1 , string FileName2) { Bitmap file1

  • 0

I tried this code:

private void CreateAnimatedGif(string FileName1 , string FileName2)
        {
            Bitmap file1 = new Bitmap(FileName1);
            Bitmap file2 = new Bitmap(FileName2);
            Bitmap bitmap = new Bitmap(file1.Width + file2.Width, Math.Max(file1.Height, file2.Height));
            using (Graphics g = Graphics.FromImage(bitmap))
            {
                g.DrawImage(file1, 0, 0);
                g.DrawImage(file2, file1.Width, 0);
            }
            bitmap.Save(@"d:\test.gif", System.Drawing.Imaging.ImageFormat.Gif);
        }

In general it’s working. But the result is not good enough.

  1. The first image since the code try to make it in same size in the height I see some black space on the bottom.

  2. The second image is bigger then the first one. The second image is on the right. So I need that it will make the left image the first one to be the same size/resolution of the second one.

How can I fix this code for that?

This is an example of the new image result after combined the two. And why it’s not good as I wanted:

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-17T23:59:23+00:00Added an answer on June 17, 2026 at 11:59 pm

    You can resize the left image and set some graphics property to get a better quality and try to don’t lose the quality:

    using (Graphics g = Graphics.FromImage(bitmap))
    {       
         //high quality rendering and interpolation mode
         g.SmoothingMode = SmoothingMode.HighQuality; 
         g.PixelOffsetMode = PixelOffsetMode.HighQuality; 
         g.InterpolationMode = InterpolationMode.HighQualityBicubic;
    
         //resize the left image
         g.DrawImage(file1, new Rectangle(0, 0, file1.Width, file2.Height));
         g.DrawImage(file2, file1.Width, 0);
    }
    

    The result is:

    enter image description here

    Or if you want to resize it proportionally to the new height just use:

    //calculate the new width proportionally to the new height it will have
    int newWidth =  file1.Width + file1.Width / (file2.Height / (file2.Height - file1.Height));
    Bitmap bitmap = new Bitmap(newWidth + file2.Width, Math.Max(file1.Height, file2.Height));
    using (Graphics g = Graphics.FromImage(bitmap))
    {       
         //high quality rendering and interpolation mode
         g.SmoothingMode = SmoothingMode.HighQuality; 
         g.PixelOffsetMode = PixelOffsetMode.HighQuality; 
         g.InterpolationMode = InterpolationMode.HighQualityBicubic;
    
         //resize the left image
         g.DrawImage( file1, new Rectangle( 0, 0, newWidth, file2.Height ) );
         g.DrawImage(file2, newWidth, 0);
    }
    

    Infact the result is better:

    enter image description here

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

Sidebar

Related Questions

I tried this code but its not working: private void LoadKeys(Dictionary<string,List<string>> dictionary, string FileName)
I tried this code to export a registry key to a file. private void
I tried this code: private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToInt32(e.KeyChar) ==
I have this code: private void FillCombobox() { using (InventoryEntities c = new InventoryEntities(Properties.Settings.Default.Connection))
i have a problem, i tried this code : private void button1_Click(object sender, RoutedEventArgs
I tried this code to open a file in Python: f = open("/Desktop/temp/myfile.txt","file1") It
To read i tried this code: In the top of Form1 i did: Dictionary<string,
I have this code: private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e) { if (listBox1.SelectedItem !=
I use this code to show user control on main form private void MainForm_Load(object
I have this code: private void inflateMenu() { if (menu == null) { mFanView

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.