Sign in to follow this  
roro69

Create new document

Recommended Posts

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

Share this post


Link to post
Share on other sites

If I'm understanding this correctly you don't need a plugin. 

With Paint.NET open click on File >>> New (or  Ctrl + N) and enter your width/ height dimensions in the pop up window.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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: 

 

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

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 by HyReZ
  • Like 1

Share this post


Link to post
Share on other sites

 

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 by roro69

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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"

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

 

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this