Sign in to follow this  
ShayEr

Image To Code (AKA Image To C) Plugin

Recommended Posts

Hi,

This is an old school image-to-code addin for Paint.NET 3.0, it will take an image and will convert it to code.

From there you can compile the image into your code as data.

Currently only C/C++ is supported and not all the formats are tested.

In order to install it copy the dll into %ProgramFiles%\Paint.NET\FileTypes

Cheers.

Share this post


Link to post
Share on other sites

I just tried it. Works pretty good.

Would you be able to make it so you could use this to output a PDN Palette file?

I have no programing experiance. That said, could you calculate the 96 most used colors in an image and then output them in HEX order to a .txt file?

Share this post


Link to post
Share on other sites
How does it work?

It will just take the image and convert it to a C/C++ data structure.

What is the size limitation of the picture?

No size limitation, it will output array as big as you image.

What could we do with the code?

You can take the data structure as use it in your code, today most ppl can use resources to achieve that, but under some circumstances (embedded device for example) you can't and your only way to store gfx is using your code data segment.

Share this post


Link to post
Share on other sites
Is there any way to add the option to recompile the code as an image?

BTW...This is pretty cool!

Sounds cool to implement, but currently this is a one way tool.

Share this post


Link to post
Share on other sites
I just tried it. Works pretty good.

Would you be able to make it so you could use this to output a PDN Palette file?

I have no programing experiance. That said, could you calculate the 96 most used colors in an image and then output them in HEX order to a .txt file?

a. Palette has 256 color not 96.

b. In the near future I will add support for 8 bit palettized images.

Share this post


Link to post
Share on other sites
I just tried it. Works pretty good.

Would you be able to make it so you could use this to output a PDN Palette file?

I have no programing experiance. That said, could you calculate the 96 most used colors in an image and then output them in HEX order to a .txt file?

a. Palette has 256 color not 96.

b. In the near future I will add support for 8 bit palettized images.

ShayEr, that may be true, but a Paint.NET palette file only contains room for 96 colors.

Share this post


Link to post
Share on other sites

(..) it will take an image and will convert it to code.

From there you can compile the image into your code as data.

It seems to do just what was promised. Surely it is the job of your code to manipulate and interpret the data structure, and not a Paint.NET plugin?

Share this post


Link to post
Share on other sites
Namely allow for text to be turned back into the image.

You can already do that. Just add a block of code to save the image and run the modified program ... ?

Share this post


Link to post
Share on other sites

Doesn't work with 4.0; any chance it can be updated?

This plugin is looking for PdnLib.dll, which hasn't been part of paint.net for ages. If I remember correctly, PdnLib.dll became PaintDotNet.Core.dll.

In paint.net v4, the aliasing of PdnLib.dll to PaintDotNet.Core.dll was removed, thus breaking compatibility with old plugins like this ones. So possibly, the only change required to make the plugin compatible, would be to swap out that assembly reference.

You could send an email directly to @ShayEr, and ask him to make that change. He provided his email address in the ReadMe.txt file.

 

Edit: Sorry, incorrect info.

Edited by toe_head2001

Share this post


Link to post
Share on other sites

The PdnLib.dll -> PDN.Core.dll redirection is still there in the latest build. I haven't removed it.

 

You say "it doesn't work" but haven't provided any further details ...

  • Upvote 1

Share this post


Link to post
Share on other sites

The PdnLib.dll -> PDN.Core.dll redirection is still there in the latest build. I haven't removed it.

Oh, my mistake. My faulty memory I guess. :/ 

 

My assumption was obviously wrong then, and the issue lies somewhere else.

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