roro69 Posted October 3, 2018 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
roro69 Posted October 3, 2018 Author 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
Ego Eram Reputo Posted October 3, 2018 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
roro69 Posted October 3, 2018 Author 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
HyReZ Posted October 3, 2018 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
roro69 Posted October 5, 2018 Author 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
roro69 Posted October 5, 2018 Author 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
toe_head2001 Posted October 5, 2018 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
roro69 Posted October 5, 2018 Author 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
toe_head2001 Posted October 5, 2018 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
roro69 Posted October 5, 2018 Author 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
BoltBait Posted October 5, 2018 Posted October 5, 2018 Why delete the file? Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game
Rick Brewster Posted October 5, 2018 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
roro69 Posted October 6, 2018 Author 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
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.