Jump to content

Create new document


roro69

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
Link to comment
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: 

 

Link to comment
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

 

Link to comment
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


 

Link to comment
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
Link to comment
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

Link to comment
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"

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
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
Link to comment
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

Link to comment
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.

Link to comment
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.

×
×
  • Create New...