Sign in to follow this  
Followers 0
FremyCompany

Alpha 32bits Bitmap Support for Paint.NET

25 posts in this topic

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 latest version of this plugin here http://forums.getpaint.net/index.php?/topic/11201-alpha-32bits-bitmap-support-for-paintnet/#entry308033 (post #7 in this thread)

BMP32 Paint.NET FileType.zip

SourceCode.zip

0

Share this post


Link to post
Share on other sites

ooh... I've been waiting for this! :D

There is however a bug in the current version... the whole image is shifted 1 pixel to the left in the resulting bitmap...

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
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...

0

Share this post


Link to post
Share on other sites

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

1

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites
Thanks for the update. Could you change it to a ZIP file?

Yes, sorry. I found a bug with it, too, so I'm making a couple changes, then I will re-upload in ZIP format.

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
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.

0

Share this post


Link to post
Share on other sites

Cool, I'm updating my PDN and found that you'll did a graet job with this plugin :)

0

Share this post


Link to post
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.

0

Share this post


Link to post
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?
0

Share this post


Link to post
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.

0

Share this post


Link to post
Share on other sites

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

Edit: removed, as the attachments above have been restored.

0

Share this post


Link to post
Share on other sites

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
1

Share this post


Link to post
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.

0

Share this post


Link to post
Share on other sites

Yes it was like gone 3am I was tired just trying to post that to save other people a load of hassle trying to get it to work.

0

Share this post


Link to post
Share on other sites

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! :)

0

Share this post


Link to post
Share on other sites

So is there any chance of this being updated? Ever since v4.0 it simply throws an error and does nothing.

0

Share this post


Link to post
Share on other sites

The plugin available in post 7 works as expected in Paint.NET 4 (load and save).

So if you are getting an error you should provide more details.

0

Share this post


Link to post
Share on other sites

It would appear that said attachment does indeed work without throwing errors. But at that place it's only natural not to see it :P

 

It never was moved to the OP afterall.

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0