Jump to content

Alpha 32bits Bitmap Support for Paint.NET


FremyCompany
 Share

Recommended Posts

Moderators Note:  Support for 32-Bit (with alpha) Bitmaps has been built into Paint.NET since v4.2.

 

 

If you want to edit .MSSTYLES or another DLL or ressources files (to make new skin/style for Windows XP or another application that use 32bpp bitmaps), you will probably see that a great amount of images the windows's skins are using are 32bits-bitmaps. And when you open these bitmaps on almost all applications, the alpha chanel is dropped due to the non-support of this sort of BMP in Windows Bitmap Loading API (for win 3.1 / win 95 historical reasons).

Paint.NET doesn't escape from the rule and load/save bitmaps as they were in 24bpp.

This plugin allow you to open and save file in 32-bit bitmap.
The only thing you must do is to rename it to *.bmpx (to avoid conflit with the existing PDN's BMP handler).
If you try to open non-BMP files, you should receive an error (rem: 24bpp bitmaps are loaded correcty too).

This plugin is perfectible and I'll publish updates if you find bugs/things to change.

Changelog [2.6 <== 1.xx] :
- Application optimised
- Fixed a problem of 1px translation on Windows
- Support now all bitmaps (and not only 32bpp)

 

 

Moderators Note:  Find the a new version of this plugin here:

https://forums.getpaint.net/topic/11201-alpha-32bits-bitmap-support-for-paintnet/?do=findComment&comment=308033

 

BMP32 Paint.NET FileType.zip

SourceCode.zip

Edited by toe_head2001
Link to comment
Share on other sites

  • 3 months later...

Yes, I already have seen this little bug, but this is not a problem in my code but a problem with some mis-encoded bitmaps....

The problem is that Windows (XP up to Vista) doesn't support 32bits bitmaps, and they shift properly written bitmapts by 1px. Others applications and OS doesn't (try opening your images with Safari for Windows, you should not see the 1px-shiftage).

In a future version, I could give the possibility to read/write the bitmap in both formats. But because nobody has responded to my message, I've not worked on my plugin anymore because he worked well for my own use. If you are interested, I can publish another version in 1 or 2 weeks (now I've examens at school).

Fremy

Link to comment
Share on other sites

Yes I would indeed be interested :-)

I think the shifting of the bitmap is actually by MS design, not sure why though. I'm using the 32-bit bitmaps for custom theming a Windows application and load the bitmap using standard Windows API calls (Windows XP/Vista DOES support 32-bit bitmaps internally :wink: in fact... the whole theming support is based around the format, explorer doesn't display them correctly though paradoxially enough) anyway... though without the manual shifting before saving in PDN with your plugin it will appear displays shifted 1px.

Actually... I did notice that reopening a manually shifted image using your plugin will open the image unshifted in PDN... so it looks like it is suppose to look... problem is that when making changes and saving again it will be shifted again. So (to me) it appears like it should simply always shift 1px on saving and that's that...

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

It looks like this uses Bit Field compression which apparently is not understood by the Win32 LoadImage() API function. I created a similar one-pixel 32-bit BMP image in both Gimp and Paint.NET (using this plug-in) and I could load the Gimp image but not the Paint.NET one in my Win32 app. The only difference I could see is the compression method (Gimp doesn't use one).

[Edit]

If anyone is interested, I've made some changes to the source so that the BMP no longer uses compression. This version should play nice with Win32 LoadImage().

BmpX.zip

  • Upvote 1
Link to comment
Share on other sites

Thanks for the update. Could you change it to a ZIP file?

Link to comment
Share on other sites

Thanks. We have enough trouble with ZIP files without introducing RAR files too :lol:

Link to comment
Share on other sites

Thanks. We have enough trouble with ZIP files without introducing RAR files too :lol:

:mrgreen: , I hear ya. ZIP file uploaded. Turns out there weren't any bugs afterall (at least not to MY knowledge). Just some differences in the way transparency is treated (Gimp uses black with an alpha channel of zero, PDN uses white). It did give me the chance to add comments where I made changes to the original code, though.

Link to comment
Share on other sites

  • 1 year later...

Some forum attachements have been lost or corrupted in the recent forum outage. If the link cannot be resurected the plugin may have to be uploaded again.

Link to comment
Share on other sites

Some forum attachements have been lost or corrupted in the recent forum outage. If the link cannot be resurected the plugin may have to be uploaded again.

Thanks for the quick reply, should I PM the OP of the thread and ask him/her to reupload the file?
Link to comment
Share on other sites

Original poster was last here in May 2008, I suspect that a PM would be a waste of time.

Give it a couple of days. If we can't locate the attachment at least we have the source file to try and recreate the plugin.

Link to comment
Share on other sites

  • 2 weeks later...

I've recompiled it from the source, which is apparently the only working attachment in this thread. Lemme know if it works...

No, it DOES NOT WORK.

However, I have used the plugin from #7 successfully to edit a transparent bmp in an exe file, so #7 is good for sure. A mod should edit post #1 to point to post #7.

Edited by Duck
  • Upvote 1
Link to comment
Share on other sites

A mod should edit post #1 to point to post #7.

If you ask nicely, Pyrochild might do it for you. He was good enough to recompile the original after all.

You should not forget the power of politeness. PLEASE and THANK YOU go a long way around here.

Link to comment
Share on other sites

  • 2 years later...

This plugin is extremely useful for creating alpha-channel bitmaps for Visual Studio 2010 (even if VS2010 can't properly deal with them and renders the transparency as black).

 

Just to note that while the 'BMP32 Paint.NET FileType.dll' and 'BmpX.dll' in posts #1 and #5, respectively, both allow Paint.NET V3.5.10 to export a BMPX, neither of these allow the BMPX to be properly displayed in VS2010 (i.e. need to first rename to .BMP).  Trying to open the BMP in VS Resource Editor results in a message "Cannot load file. Unknown bitmap format." being displayed twice, followed by an error message once "Unknown bitmap format.".

 

Only post #7 (date 2010.Feb.02) by Dev and its BmpX.zip attachment, holding the 'BMP32 Paint.NET FileType.dll", allows a BMPX to be generated and then work properly in VS2010 (after renaming to .BMP).  This probably makes sense from what Dev wrote around the Win32 API call to LoadImage().

 

So I concur with #18 Duck's assertion on 2011.Apr.20 that only #7 Dev's attachment works.

 

In terms of the value of this thread...thx again...and BUMP! :)

Link to comment
Share on other sites

  • 1 year later...

I've added a note linking to the correct post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...