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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:37:48+00:00 2026-05-21T10:37:48+00:00

I was hoping some one could help me with this problem. I am currently

  • 0

I was hoping some one could help me with this problem. I am currently using ImageMagick.NET wrapper to convert transparent png images to bitmap (we are doing this as we need the added image processing functionality that comes with c++ imageMagick). Now everything works great except when I use an image where there is transparency in it. The transparent area tends to turn into black when I do the conversion. Now here is my problem the code that is doing the conversion is in c++ and finding it hard to work out what it is ecavtly doing. Please see the code below:

System::Drawing::Bitmap^ Image::ToBitmap()
    {
        System::Drawing::Bitmap^ bitmap = 
            gcnew System::Drawing::Bitmap(image->columns(), image->rows(), 
            System::Drawing::Imaging::PixelFormat::Format24bppRgb);

        System::Drawing::Imaging::BitmapData^ bitmapData = bitmap->LockBits( 
            System::Drawing::Rectangle(0,0,image->columns(), image->rows()), 
            System::Drawing::Imaging::ImageLockMode::ReadWrite,
            System::Drawing::Imaging::PixelFormat::Format24bppRgb);

        unsigned char *ptr = (unsigned char *) bitmapData->Scan0.ToPointer();
        std::string map = "BGR";
        for( int i=0; i<image->rows(); i++ )
        {
            image->write(
                0, i, image->columns(), 1, map,
                MagickCore::CharPixel, (void *)ptr);
            ptr += bitmapData->Stride;
        }

        bitmap->UnlockBits(bitmapData);
        return bitmap;
    }

Can any one help be decipher the c++ code or point me to the right direction. Any info will be a great help.

Many 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-05-21T10:37:49+00:00Added an answer on May 21, 2026 at 10:37 am

    Bitmaps do not support transparency. Generally you do it the other way around. You have a BMP select a color that means transparent and when converting to a format that supports transparency that color is made transparent.

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

Sidebar

Related Questions

Im using the .NET framework 1.1 and Im hoping someone could help me implement
I'm hoping to get some help with this weird problem. We're running the Jacorb
I was hoping someone could help me out with this stupid problem I'm having
hoping this is an easy enough question :) Some details: I am using Flash
I was hoping that someone can help me with this fancybox plugin issue. Problem
This has been a hard problem to diagnose and I was hoping someone could
I am hoping someone can help me this this problem. I know how to
I was hoping someone could give me a hand on how I write this
I am having a problem with LINQ and I was hoping someone could explain
I am sure someone has this done already, and was hoping someone could share

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.