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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:51:22+00:00 2026-06-04T14:51:22+00:00

I’m using several 32 bit PNG files in my VS2010 project and loading them

  • 0

I’m using several 32 bit PNG files in my VS2010 project and loading them into GDI+ bitmaps using LoadResource/LockResource etc. and creating from an IStream. All is working fine and dandy on my Win7 development machine.

However, I’m doing some colour and alpha masking using SetColorMatrix/ImageAttributes which works fine on Win7, but when I run it on XP and call Bitmap::DrawImage with an ImageAttributes parameter, the PNG isn’t drawn at all. There don’t appear to be any errors at any point to suggest a problem, it just isn’t visible.

If I run the same code with the image loaded directly from file instead of from a resource, it works fine on XP and Win7, but I don’t really want to bundle PNG files in my installer – it seems a bit of a bodge. To make life that bit more exciting, my XP machine is too slow to even contemplate running VS2010!

Has anyone got any ideas what could be causing this, or suggestions as to track the problem down because I’ve spent a long time on this and I’m out of inspiration.

Thanks in advance.

Update :

After a load more testing I haven’t entirely got to the bottom of this, but there’s strong evidence to suggest that using the Bitmap(IStream*) constructor is somehow mangling the alpha channel on PNGs with transparency. I haven’t figured out exactly what’s going on, but I have found a solution – I’m now using FreeImage to load the PNG from the resource file, then creating the Bitmap object from the raw image data in the FIBITMAP. This is working perfectly, so the evidence is pointing to a problem with that Bitmap constructor.

Update 2 :

The class I created to use FreeImage to load the PNG files from resources works great so for convenience I decided to use it to load all my images but it was having trouble loading standard BMP files. After a bit of investigating, it seems that when you include BMP files as BITMAP resources, the first 14 bytes of the BMP file are stripped before they’re stored in the resource bundle, which makes it tricky for anything else to load them. Anyway, it’s easily worked around – I just changed the resource type of the “BITMAP” resources to “BMP” so it basically treats it as an unknown type and stores the whole file. So now it’s all working as intended. Just thought I’d post the experience and hopefully save someone else an hour if they try to do the same thing.

  • 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-04T14:51:24+00:00Added an answer on June 4, 2026 at 2:51 pm

    So I found the answer myself in the end (just updating this so that I can mark it as answered).

    There appears to be some sort of bug related to GDI+ and transparency in PNGs in some situations. I got around this using FreeImage to load the PNGs, but this caused another problem with BMPs. It seems that BITMAP resources in VS get 14 bytes stripped off them, presumably as this is redundant information if you’ve already told VS it’s a bitmap. This is normally fine if you then load the resource with LoadImage() or any standard WinAPI function, but if you use another library (as I was with FreeImage), then you need to change the resource type to IMAGE (or something that’s not BITMAP) before you try and load it using LoadResource.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into

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.