roro69 Posted October 3, 2018 Share Posted October 3, 2018 Hello, I would like to know if it is possible from a plugin to create a new document. That's my problem: I create new documents but I have to calculate their area as follows: The height of the surface I desire is height 10 times The width of the surface I want is width / 2 Example: My input data 624 * 22 What will give when I create new document Width 312 pixels Height 220 pixels So what I wanted was to get my entry information; then create a new document with the good dimensions Thank you for your response, and thank you for your time Quote Link to comment Share on other sites More sharing options...
roro69 Posted October 3, 2018 Author Share Posted October 3, 2018 Hello I'm sorry for the english approximatf; but I want to automate the dimensions of the canvas because I have to calculate them each time with my input Thank you for your answers and help provided Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted October 3, 2018 Share Posted October 3, 2018 Effect type plugins cannot create new canvasses to work on. They are allowed to work on the active layer of the active image and that's it. More can be found here: Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
roro69 Posted October 3, 2018 Author Share Posted October 3, 2018 Hello, thank you for the response If I understand correctly it is possible to create a blank bitmap in windows clipboard and load it in paint net ; so if that's the case, can you help me to code this solution? Thank you for your answers and help provided Quote Link to comment Share on other sites More sharing options...
HyReZ Posted October 3, 2018 Share Posted October 3, 2018 (edited) Greetings roro69, You can create blank templates within Paint.NET. I have a folder on my desktop called Paint.NET templates. When I need one; I simply look within the folder for the desired template and right-click on the template and then select 'Open with' and then select Paint.NET. If the template is saved as a PDN file, just double-click on its icon and it will automatically launch into Paint.NET. Edited October 3, 2018 by HyReZ 1 Quote Link to comment Share on other sites More sharing options...
roro69 Posted October 5, 2018 Author Share Posted October 5, 2018 (edited) Hello, thank you for the response I will make a small application that will create my bitmap to the desired size and then with System.process.start I will start paint net with this bitmap. Thanks for the time and help Edited October 5, 2018 by roro69 Quote Link to comment Share on other sites More sharing options...
roro69 Posted October 5, 2018 Author Share Posted October 5, 2018 Good evening I tried with the code below but I do not understand the software tells me type unrecognized image Dim painte As String = "C:\Program Files\paint.net\PaintDotNet.exe" Dim s As String = System.IO.Path.GetTempFileName() Dim monimage As Bitmap = New Bitmap(200, 200) monimage.Save(s, Imaging.ImageFormat.Png) Dim p As Process = Process.Start(painte, s) 'maybe here's a better way to wait While p.MainWindowHandle = IntPtr.Zero System.Threading.Thread.Sleep(100) End While System.IO.File.Delete(s) Merci de votre aide Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted October 5, 2018 Share Posted October 5, 2018 3 minutes ago, roro69 said: Dim s As String = System.IO.Path.GetTempFileName() monimage.Save(s, Imaging.ImageFormat.Png) Your save path is the Temp directory. It needs to have a filename too. Ex: System.IO.Path.GetTempFileName() + "myImage.png" Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
roro69 Posted October 5, 2018 Author Share Posted October 5, 2018 Good evening thank you for your solution I tried and the software tells me file not found. Here is the error log Quote System.IO.FileNotFoundException: Le fichier 'C:\Users\Roro\AppData\Local\Temp\tmp7E8A.tmpmyImage.png' est introuvable. Nom de fichier : 'C:\Users\Roro\AppData\Local\Temp\tmp7E8A.tmpmyImage.png' à System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) à System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) à System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) à PaintDotNet.Controls.DocumentWorkspace.LoadDocument(Control owner, String fileName, FileType& fileTypeResult, ProgressEventHandler progressCallback) dans D:\src\pdn\src\PaintDotNet\Controls\DocumentWorkspace.cs:ligne 3220 Thank you for your help and time Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted October 5, 2018 Share Posted October 5, 2018 1 minute ago, roro69 said: I tried and the software tells me file not found. Ok, so go into the temp directory and verify that the file was actually saved there. Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
roro69 Posted October 5, 2018 Author Share Posted October 5, 2018 Good evening no it is not actually While p.MainWindowHandle = IntPtr.Zero System.Threading.Thread.Sleep(100) End While System.IO.File.Delete(s) the file is delete before being launched Supend time is not long enough I will try another try thank you Quote Link to comment Share on other sites More sharing options...
BoltBait Posted October 5, 2018 Share Posted October 5, 2018 Why delete the file? Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 5, 2018 Share Posted October 5, 2018 You're going way outside the bounds of what we can help you with regards to Paint.NET development. It sounds like you need regular .NET and VB help. 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...
roro69 Posted October 6, 2018 Author Share Posted October 6, 2018 Hello Thank you for your answers ; Rick: Yes I am sorry, I have deviated a little from the development Paint Net; my original question was about it; I wanted to know if we could program directly in paint net a script to create a new document because the dialog box of the software is not appropriate for my use. BoltBait: in fact it's true it's useless.Thanks In any case thank you for your help and your time. 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.