UweR70 Posted August 12 Share Posted August 12 Hi community / hi admins! I have a question about the paint dot net layer functionality - consumed via C#. I would like to create and store an image with for example five layers and store it as "*.pdn" file. So fare normal use of the paint.net application - and no issue here. I would like to load the file in my Visual Studio solution at runtime and show the images first and third layer only. Since the Nuget package "PaintDotNet.Core" is no longer available, the following unfortunately no longer works: (becasue "PdnFileType()" is now a internal class) // Load the PDN file string pdnFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "/Images/Test.pdn"); using (FileStream fs = new FileStream(pdnFilePath, FileMode.Open, FileAccess.Read)) { PdnFileType pdnFileType = new PdnFileType(); Document document = pdnFileType.Load(fs); ... } I´ve tried to reference the DLL´s copied during paint.net app installation, but had no luck to get it up and running. Any ideas? Quote Link to comment Share on other sites More sharing options...
Tactilis Posted August 12 Share Posted August 12 Welcome to the forum @UweR70 I can't help with your immediate problem but be aware that in future the .pdn file format will be changing and there will likely be a public specification. See this comment: https://forums.getpaint.net/topic/124516-pdn-file-format/?do=findComment&comment=620365 Note that there is no timeline for the format revamp. Quote Link to comment Share on other sites More sharing options...
UweR70 Posted August 12 Author Share Posted August 12 Thanks for your very fast response. This is really very frustrating and unsatisfactory! On the one hand, the app makes layer handling extremely easy, but on the other hand, the layers contained in the saved file cannot be used in other (self-written) apps! My requirement would be extremely easy for you to implement. Add a (public) parameterless ctor to "FileType.cs" and/or add a static instance property, I would then do the rest via refelction. ... But let's see if I can do it without these desired changes. Quote Link to comment Share on other sites More sharing options...
Tactilis Posted August 12 Share Posted August 12 5 minutes ago, UweR70 said: My requirement would be extremely easy for you to implement I implement nothing. @Rick Brewster is the developer of paint.net I was just giving you a heads up that there will be a public specification of the revamped format in the future as a means of encouraging interoperability. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted August 12 Share Posted August 12 2 hours ago, UweR70 said: This is really very frustrating and unsatisfactory! Let's get this part out of the way first: Paint.NET is not an SDK and you cannot incorporate its DLLs into your application, nor can you distribute its DLLs. Full stop. Whether or not this is "frustrating" or "satisfactory", or whether it would be "extremely easy for [me] to implement", is irrelevant. If you're just hacking on your own private, personal code that you won't be distributing, then I don't really care what you do. Name one of your assemblies PdnTest and access whatever you want. However, if you're doing this for work, business, profit, etc. or any kind of distribution beyond yourself, then you need to turn around and GTFO right now. Like @Tactilis said, the .PDN file format will be evolving to support exactly what you are asking for. Hopefully I can also craft up a reader for the current (soon to be legacy) format. Currently this sort of thing is a difficult proposition because the .PDN file format uses .NET Binary Formatter Serialization and thus relies on and requires a significant portion of the actual internal code of Paint.NET in order to be read or written. This means distributing an SDK would mean distributing and licensing the app itself for redistribution, and lots of people and companies would say "OH, that means I can steal half of Paint.NET and use it in my own app and make money off of it." And then you'd see literal clones of Paint.NET with the name scratched off and a new one written in crayon (this literally used to happen). So that's why things are the way they are today, and why I've taken such a harsh tone for a lot of this reply -- I'm not so much replying to you as I am making things crystal clear for anyone else who comes across this discussion, via google search or whatever. However, the timeline for the big update to Paint.NET that incorporates all of this is not defined. It may take a year, it may take three years, I don't know. It'll be ready when it's ready, and it's not going to be rushed. It is more important to get this right than to get this done soon. It may be useful to know that this is next in the queue and will be the next project that I take on after the release of 5.1. 4 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Rick Brewster Posted August 12 Share Posted August 12 Also worth mentioning is that I do plan on making a nuget package whose sole job is to provide the ability to read and write the current .PDN file format, and that this will be done at some point after 5.1, and won't be gated on 6.0's release (6.0 being the release with the revamped and highly upgraded .PDN format). Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
UweR70 Posted August 12 Author Share Posted August 12 To be clear: YES, its a private "project". Nothing commercial! Nothing will be distributed, etc. Ok, so I am awaiting next version ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.