Sign in to follow this  
zeeshanejaz

PNM File Type Plugin

Recommended Posts

The FileType Plugin to read and write PNM Images

 

MODERATORS NOTE:  This effect is incompatible with Paint.NET 4.0x

PNMPlugin.zip

PNM File Types
PNM is a portable bitmap format used in legacy software. The use of PNM file format is more common in LINUX / UNIX Platform. PNM file format consists of three different file formats namely PBM, PGM and PPM. (Corrections suggested by Andrew Kirillov, thank you.)

PBM [Portable Bit Map - Binary]
PGM [Portable Grey Map - GreyScale]
PPM [Portable Pixel Map - Color]

Each of these file formats can be written in ASCII or Binary Encoding. The encoding is determined at reading time against the Identifier each PNM file contains called "Magic Number". This is always the first token of the PNM file.

"P1" [PBM - ASCII Encoding]
"P2" [PGM - ASCII Encoding]
"P3" [PPM - ASCII Encoding]
"P4" [PBM - Binary Encoding] (not yet implemented)
"P5" [PGM - Binary Encoding]
"P6" [PPM - Binary Encoding]

16-bit Extensions
The original definitions of PGM and PNM do not describe 16-bit pixel formats. It has, however been used in many practical situations where accuracy/depth of color information matters. This plugin does not currently support the 16-bit extensions.

Share this post


Link to post
Share on other sites

This is exactly what I was looking for. I like to write ray tracers, and PPM is a brain dead way to dump an image into disk.

One bug that I noticed though is that it seems like the red and blue channels are swapped when loading (but not when saving). I tested this with a third party PPM viewer to make sure (just in case there was a bug in my code).

Means that if I want to load my images into Paint.NET I actually have to swap my red and blue channels as I am saving so when I load it everything will appear as expected.

Share this post


Link to post
Share on other sites

Since I have the same issue, I have try to correct it.

I have used the original plugin, reverse it to made a correction.

So I have corrected : PPM P6 format (binary format only, and the size of the combobox when saving an image.

Hope it will help somebody.

Share this post


Link to post
Share on other sites

Here the dll... looks like .rar are forbidden.

I have replace the lockbits by a simple SetPixel which is slower but easier to use.

I will see if I can go back to LockBits

Edited by dfleury2

Share this post


Link to post
Share on other sites

Thanks for the update dfleury.

Can you please remove your earlier versions of the plugin (i.e. edit your post to remove the attachment), leaving just the latest version. Thanks.

I'll edit the original post to include your update if someone who uses the filetype can give it a thorough testing for me.

Any takers?

Share this post


Link to post
Share on other sites

Does this go in File Type or Plugin? The latest version says PMNplugin, but this is used for saving filetypes... Bit confusing IMHO

Nvm, confused effects with plugins.

Edited by FriendlyFire

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