Jump to content
How to Install Plugins ×
Paint.NET 5.1 is now available! ×

Recommended Posts

Posted

Signature stamp

 

Signature00.png

 

What's this?

This is a fast way to add a signature stamp to your art. To make it even faster I provide you the source for CodeLab so you could personalize your signature and compile your own plugin with it. Doing this, adding your favorite signature to your art will be as short as Menu Effect/Signature/Ok. Done!

 

This plugin was made using CodeLab v3.3.

 

 

Download it!

No dll, you’ll have to use CodeLab to create your own.

ar.png  Here is the Signature kit zip file http://jcljay.free.fr/pdn/Signature.zip

 

It contains:

-       Signature.cs: source code for CodeLab (need personalization the first time).

-       Signature.png: image/icon.

-       Frame.png: frame sample you could use as a base (add your text inside).

-       Signature.dll: yes you could have a built version…

-       Install_Signature.bat: Run this program to install Signature.dll (paint.net must be closed).

 

 

The MadJik's All plugins package is available!

http://forums.getpaint.net/index.php?showtopic=7186 

 

 

How to install

Unzip the Signature kit file

Install Signature.dll using Install_Signature.bat

 

 

To personalize your signature

Open Paint.net and play with the plugin to find the Signature you want

When it’s good, make a note of the settings you used (or screenshot).

 

 

Open CodeLab

Open Signature.cs

 

-line 10: Amount1, replace false by true

-line 24: if your Signature is a picture, Amount15, replace false by true

-line 41 to 52:

Put here ONLY the settings (from your note or screenshot) you want to be fix.

 

Signature_Code1.png 

Be sure these settings are locked by Amount1 in the lines 11-24

 

 

Signature_Code2.png 

 

            To use a picture, save it using an easy path (e:\pdnsig\sig18-02.png)

            NB: In the source you must type double slashes \\ in the text path Amount2. (like line 54) or use @ like:  Amount2 = @"e:\pdn\sig02-2018.png";

 (Amount6 and Amount7 in the source are unlocked, Amount2 is locked, once built and “Personal signature” checked you could change the position and the margin, but you can’t change the text).

 

Build the dll, close paint.net

Run Install_Signature.bat from your desktop (must be success!)

 

For Microsoft Store version of Paint.net

You can’t use the Install_Signature.bat.

(Re)place the DLL in your Effect folder usually:

My Documents/paint.net App Files/Effects (please reverse / for correct path)

 

You have to adapt for your language My Documents

 

 

 

The User interface

This plugin is added to the menu Effects, no submenu to save a click.

Signature_UI.png

 

NB: depending how deep you changed the source the interface could be different.

 

Personal signature

When checked, the settings hardcoded will override the interface. Uncheck to be able to fully use the interface.

NB: By default, the signature text is empty and the font is set to the first of the list.

 

Signature text

Your text here…

It could also be a valid path to an image. Check last checkbox in this case.

NB: only one slash when you use the interface.

 

Size  (10=100% for image)

Size of the font to use.

Effect Zoom/Reduce on the image sig, 10=100%, 5=1/2 size, 20=2x size.

 

Font

Select the font name you want. You could use the cursor arrows up/down to see other fonts.

NB: By default, the font is the first name of the list. It depends the fonts installed on your system.

 

Margin

Set the distance of the signature (text or image) to the border of the canvas.

NB: Negative value could be used for some fonts that have their own margin you want to reduce.

 

Position

Choose the position of the signature (text or image).

 

AntiAlias

As it says… No effect on the image sig.

 

Draw with secondary color

Choose to use the secondary color for

-outline,

-trail,

-empty rectangle

-filled rectangle.

No effect on the image sig.

 

Fore color / Back color / transparency

Initialized with the primary and secondary colors. You could change the colors and transparency using the interface. It could be necessary depending your picture (too bright or too dark).

No effect on the image sig.

 

Swap colors

Swap the two colors when checked.

No effect on the image sig.

 

Text is a valid path to an image.png

Check this box to say the text is a path to the image you want to use as signature.

 

 

The Examples:

Signature_Demo01.png 


Signature_Demo02.png 


Signature_Demo03.png 


Signature_Demo04.png 

 

Signature_Demo05.png

 

Signature_Demo06.png

 

 

Voilà! Enjoy!

 

Let me see what you could do with it!

 

 

 

Need help with the source?

If you want some help with your version of the source code, please ask your question in this thread and include your code in your post.

 

 

Edit: 

Save your work as pdn file with a specific layer for the signature if you want to change it later...

 

Edit2 (new version 2018-02-12):

New version:
- Some more comments inside the code for better understanding (IMO).
- Slider Size works with images (10=100% no resize, 20=resize 2x, 5=reduce 50%)
    (thanks @BoltBait for the idea and the routine)
- Drop down lists with numbers (easier to write the code)
- Secondary color choice could draw a rectangle (text only)
- Catch error to avoid crash if the image can't  be found.

 
Known (Codelab?) issues:
-Text in the RegionUI is destroied when you use the UI editor and when you build the DLL.
-Trailing spaces are trunked (if you want to enlarge the rectangle, it is possible to use Alt+0160 instead space)
-Font name is useless as a preliminary choice, the first name of the list of font is always shawn when you run the effect.
-Some font families make the calculation of the text size wrong (position of the rectangle or margin could look unexpected).

  • Like 3
  • Upvote 5
Posted

I've made some minor code improvements to your script.

Spoiler

// Name: Signature stamp
// Submenu:
// Author:MadJik (Jean-Claude JAY)
// Title: Signature stamp
// Version: 1.0
// Desc: Add your signature quickly to your art
// Keywords: text|signature|stamp|watermark
// URL: http://forums.getpaint.net/index.php?showtopic=112441
#region UICode
CheckboxControl Amount1 = false; // [0,1] Personal signature
TextboxControl Amount2 = "Your text"; // [0,255] {!Amount1} Signature text
IntSliderControl Amount3 = 12; // [6,100] {!Amount1} Size
FontFamily Amount4 = new FontFamily("Arial"); // {!Amount1} Font
ListBoxControl Amount5 = 2; // {!Amount1} Font style|Normal|Italic|Bold|Bold Italic
IntSliderControl Amount6 = 5; // [-10,400] Margin
ListBoxControl Amount7 = 4; // Position|Top-Left|Top|Top-Right|Right|Bottom-Right|Bottom|Bottom-Left|Left|Center
CheckboxControl Amount8 = true; // [0,1] {!Amount1} AntiAlias
ListBoxControl Amount9 = 2; // {!Amount1} Draw with secondary color|Nothing|Background|Trail
ColorWheelControl Amount10 = ColorBgra.FromBgr(0, 0, 0); // [PrimaryColor] Fore color
IntSliderControl Amount11 = 255; // [0,255] Fore color transparency
ColorWheelControl Amount12 = ColorBgra.FromBgr(255, 255, 255); // [SecondaryColor] Back color
IntSliderControl Amount13 = 120; // [0,255] Back color transparency
CheckboxControl Amount14 = false; // [0,1] Swap Colors
CheckboxControl Amount15 = false; // [0,1] Text is a valid path to an image.png
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    dst.CopySurface(src, rect.Location, rect);
    if (IsCancelRequested) return;

    //Here you define your "personal signature"
    //Values added here will override settings from the UI
    //Only add values you don't need to change for your signature
    if (Amount1)
    {
        //string UserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
        string UserName = "MadJik"; // © MadJik 2018

        Amount2 = "© " + UserName + " " + DateTime.Now.ToString("yyyy");
        Amount3 = 8;
        Amount4 = new FontFamily("Tahoma");
        Amount5 = 0;
        //Amount6 = 3;
        //Amount7 = 4;
        Amount8 = true;
        Amount9 = 1;
        //Amount10 = ColorBgra.FromBgr(0, 0, 0);
        //Amount11 = 255;
        //Amount12 = ColorBgra.FromBgr(180, 180, 180);
        //Amount13 = 160;
        // for an image type the valid path in Amount2 line 41 like:
        // Amount2 = @"e:\pdn\sig02-2018.png";
    }

    if (Amount15 && !File.Exists(Amount2))
    {
        Amount15 = false;
        Amount2 = Amount2 + ":Error!";
    }

    Amount10.A = (byte)Amount11;
    Amount12.A = (byte)Amount13;
    SolidBrush Brush1 = new SolidBrush(Amount12);
    SolidBrush Brush2 = new SolidBrush(Amount10);
    if (Amount14)
    {
        Brush1 = new SolidBrush(Amount10);
        Brush2 = new SolidBrush(Amount12);
    }

    Graphics g = new RenderArgs(dst).Graphics;
    g.Clip = new Region(rect);
    if (Amount8)
    {
        g.SmoothingMode = SmoothingMode.AntiAlias;
        g.InterpolationMode = InterpolationMode.HighQualityBicubic;
        g.PixelOffsetMode = PixelOffsetMode.HighQuality;
    }
    else
    {
        g.SmoothingMode = SmoothingMode.Default;
        g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit; //add this line to make text good looking
    }

    // case 0: //Normal
    FontStyle sf = System.Drawing.FontStyle.Regular;

    switch (Amount5)
    {
        case 1: //Italic
            sf = System.Drawing.FontStyle.Italic;
            break;
        case 2: //Bold
            sf = System.Drawing.FontStyle.Bold;
            break;
        case 3: //Bold Italic
            sf = System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold;
            break;
    }
    Font SelectedFont = new Font(Amount4, Amount3, sf);

    string SigText = Amount2;

    Size stringSize = g.MeasureString(SigText, SelectedFont).ToSize();
    
    int TextW = stringSize.Width;
    int TextH = stringSize.Height;
    Bitmap b = null;
    if (Amount15)
    {
        // read an image
        b = (Bitmap)Bitmap.FromFile(Amount2);
        TextW = b.Width;
        TextH = b.Height;
    }

    // case 0: //Top-Left
    int TopX = selection.Left + Amount6;
    int TopY = selection.Top + Amount6;

    switch (Amount7)
    {
        case 1: //Top
            TopX = (selection.Width - TextW) / 2 + selection.Left;
            break;
        case 2: //Top-Right
            TopX = selection.Width - TextW + selection.Left - Amount6;
            break;
        case 3: //Right
            TopX = selection.Width - TextW + selection.Left - Amount6;
            TopY = (selection.Height - TextH) / 2 + selection.Top;
            break;
        case 4: //Bottom-Right
            TopX = selection.Width - TextW + selection.Left - Amount6;
            TopY = selection.Height - TextH + selection.Top - Amount6;
            break;
        case 5: //Bottom
            TopX = (selection.Width - TextW) / 2 + selection.Left;
            TopY = selection.Height - TextH + selection.Top - Amount6;
            break;
        case 6: //Bottom-Left
            TopY = selection.Height - TextH + selection.Top - Amount6;
            break;
        case 7: //Left
            TopY = (selection.Height - TextH) / 2 + selection.Top;
            break;
        case 8: //Center
            TopX = (selection.Width - TextW) / 2 + selection.Left;
            TopY = (selection.Height - TextH) / 2 + selection.Top;
            break;
    }
    if (Amount15)
    {
        // insert an image
        g.DrawImage(b, TopX, TopY);
    }
    else
    {
        switch (Amount9)
        {
            case 1: // draw 4x string with +/- decal for the background
                g.DrawString(SigText, SelectedFont, Brush1, TopX - 1, TopY - 1);
                g.DrawString(SigText, SelectedFont, Brush1, TopX - 1, TopY + 1);
                g.DrawString(SigText, SelectedFont, Brush1, TopX + 1, TopY - 1);
                g.DrawString(SigText, SelectedFont, Brush1, TopX + 1, TopY + 1);
                break;
            case 2: // draw 4x string with ++++ decal for the trail
                g.DrawString(SigText, SelectedFont, Brush1, TopX + 1, TopY + 1);
                g.DrawString(SigText, SelectedFont, Brush1, TopX + 2, TopY + 2);
                g.DrawString(SigText, SelectedFont, Brush1, TopX + 3, TopY + 3);
                g.DrawString(SigText, SelectedFont, Brush1, TopX + 4, TopY + 4);
                break;
        }

        // foreground draw
        g.DrawString(SigText, SelectedFont, Brush2, TopX, TopY);
    }
    
    // Dispose objects
    Brush1.Dispose();
    Brush2.Dispose();
    g.Dispose();
    SelectedFont.Dispose();
    if (b != null)
    {
        b.Dispose();
    }
}

 

 

  • Like 1
Posted
1 hour ago, MadJik said:

BTW have you seen this tuto?

Indeed I have. The thought of breaking down the objects to individual layers is too much work for me. :evillaugh:

But I have seen the proper way of using the texture object rounder to get some cool effects. B)

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.png

Posted

@MadJik - I'm having trouble with the 'insertion of an image' into the code.

 

1.  Do I save the .png image to my C drive in a folder? ( I see you have it (e:\pdnsig\sig18-02.png) so I presume you have it on an external drive?)

 

2.  Does the code go into line 41 and, if so,  does it go between the plus signs + User Name + ?

 

3.  Or does the code for the .png go on one of the lines for 32, 33, 34?

 

I think I can manage making the text in your sig-maker, but I'm using a Calligraphy font and it's ending up very 'jaggy-looking', so I have made my own and saved it to png.

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Posted (edited)

<3 @MadJik:trophy:  Thank you for sharing. :coffee:  :cake:   To understand that I have to take a course. 

 

The top two pictures where can I find them? denken.gif   (I know that in my pc) pcgirly.gif

Edited by Seerose

Live as if you were to die tomorrow. Learn as if you were to live forever.

Gandhi

 

mae3426x.png

Posted
On ‎09‎/‎02‎/‎2018 at 7:41 PM, Pixey said:

so I have made my own and saved it to png

As @IRON67 shows, the line 41 is the right place.

You have to find the path to your picture. When you use paint.net to open this sig, you could find the path when you click in the address box.

signpath.png

 

in this example E:\pdn

 

Add the name of the file to obtain E:\pdn\sig.png

 

then put this in the code line 41 (don't forget the "@" before the quote

signpath2.png

 

Check Amount1 (personal sig)is true as well Amount15=true.(my sig is a picture).

 

It should work:

signpath3.png

 

 

On ‎09‎/‎02‎/‎2018 at 7:47 PM, Seerose said:

The top two pictures where can I find them? denken.gif

You meant the two pictures after the first one?

I'm using the dark theme with paint.net and codelab.

 

You could figure out where these pictures are from if you read the top left corner (CodeLab 3..3)

Start CodeLab then Open a file and look for the file Signature.cs.

 

 

Posted

 

4 minutes ago, Pixey said:

My "path" seems kind of complicated.  How can I shorten it?

15 minutes ago, MadJik said:

you click in the address box

Windows make the path readable but not usable. You have to click in the box to have the address to copy/paste in the code. Just add the file name with extension (yoursigname.png).

  • Like 1
Posted

Many thanks @toe_head2001 @IRON67and @MadJik for your patience and help. 

 

I got it to work whilst I was in the Plugin, but I can't pull it up via the sig plugin when I'm on a new image.

new_sig.png

 

Tomorrow is another day and I will play some more then.  When I 'ace it' I would be happy to make a video for @Seerose

 

  • Like 2

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Posted (edited)

@Pixey I've understood your question about shortening the path maybe wrong. You just have a problem with the display including optical signs like arrows instead a backslash.

 

Two solutions:

 

1. Click in your Windows Explorer behind the displayed path in free space and the display should change to normal text, that you can copy (works for me with Windows 7).

 

2. RIGHTclick on your file in Windows Explorer. Under your mousepointer pops up a contextmenu. Choose "Properties". A new window appears and shows some tabs with data. Look in the first tab "General" unter LOCATION.

You can select this text with your mouse, rightclick again and choose COPY.

 

For both (1 and 2): Now you can paste this text for Codelab and add behind an additional backslash the filename.

Edited by IRON67
Posted

Okay - I'm baaaaack :mrgreen:.

 

Thank you @IRON67 I have managed finally to figure out how to get the path nowB)

 

However, although I am able to make my signature in the Plugin - I am having trouble pulling it up when I re-open PDN.

 

This is what I've been doing.

 

1. I  Unzip the Plugin to its own folder - as seen in below image.

2.  I then open Code Lab in PDN.

3. Go to File - open the signature .cs from the folder

4.  I make all the changes and my .png shows up in the right place.

5.  I then hit Build and OK and close PDN

6.  I go back to the folder and hit the Install signature bat and I see Success.

7.  I reopen PDN and upload a new image, I then go back to the Effects, and hit on the Signature, hit OK ................... but nothing shows up :(.

 

Just to be sure, I have two other Q,s in the image below:

 

Unzipped_file.png

 

Sorry for being such a 'numkin' ...................... and thank you for your help guys :D

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Posted
10 minutes ago, Pixey said:

5.  I then hit Build and OK and close PDN

 

The "Build" button in CodeLab is, in essence, more of an "Execute" button.

You need to use the "Build DLL" button. You can find it in the Toolbar, and in the File menu.

 

https://forums.getpaint.net/topic/111233-codelab-for-average-users-a-laymans-guide/#buildDll

  • Like 2
Posted (edited)

Additional note:

 

You don't really need the BAT-file. It only make it easier to put the DLL on the right place for lazy people ;) (I even can't use BAT files because I deactivated the normal behaviour because of security reasons)

You can rightclick the DLL on desktop (that is in fact a directory/folder on your harddisk), choose "Move to folder..." and select the Paint.net Effects folder.

Edited by IRON67
Posted

jumping0036.gif  

 

I did it!    Thank you so much @toe_head2001 and @IRON67 for the help.  Especially pointing out to use the Build in the File Drop down, and not the one on the Plugin.  It's a learning curve.  I will now make a video for @Seerose of how to use the Plugin using a .png.

  • Upvote 1

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Posted

Me again :D.

 

Before I make a video for @Seerose I'd like also, to show how the actual Plugin works (I now understand the .png part) but I'm having trouble getting the color to change when using the actual Plugin.

 

I have changed line 10 from False to True and then changed the colors, but it doesn't change from black.  Obviously there must be something I'm doing wrong.

 

no_change.png

 

 

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 

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...