September 22, 2021, 11:25:32 PM

------------------------------------------

If you have Login Problems Use the Login in Top Menu Bar


------------------------------------------
If you have a problem registering here, Leave a msg at our FB Page >> Here.

Plz Don't use Hotmail to Register. You might not receive Activation mail. Use Other free mail provider like Gmail or Yahoo.






Author Topic: Suuper's Scripts  (Read 5055 times)

0 Members and 1 Guest are viewing this topic.

Offline Suuper-san

  • Level 0 Writer
  • Hero Member
  • *****
  • Posts: 6040
  • Gender: Male
  • Anyone need a wall of text?
    • View Profile
Suuper's Scripts
« on: March 15, 2020, 01:51:46 PM »
So in case you don't know, I am a programmer. *nervously laughs*

I'm very keen on finding things that I can streamline and automate, and this includes writing scripts that work within GIMP
These are typically very specific to my needs so I don't really mention them much, but as I keep making scripts every now and then I make one that might be useful to other peeps.

I do recommend learning to program because it can be surprisingly useful once you see how many things you can do with code, something simple like renaming/sorting files or stuff can be automated and it really helps when you have a lot of something simple to do, plus you learn to think analytically and solve problems, which is helpful no matter where you are or what you are doing

So this is a thread for my programs and scripts that I decide to share. I do have some useful apps but they are all hacky so I don't want to share them at the moment haha.

You may also make a request for a snippet of code or a PC app that does something specific, but it's got to be interesting or useful to me for me to even think about it, but ask away.

This first post will serve as an index because I like to be organised.

GIMP Scripts
To add a GIMP script to your program, you must copy the text and save it as a file with an extension of .scm, and place the file in your GIMP scripts folder, in my case "C:\Users\MyName\AppData\Roaming\GIMP\2.10\scripts"
The script will appear in an extra menu bar called Suupersuite because it sounded cool at the time.

Lineart Softening Script

Feedback and suggestions are always welcome \(^_^)/
« Last Edit: March 15, 2020, 05:07:22 PM by suuper-san »
Art: Manga / Fanart / Requests (closed) / Other Art | Manga Stories & Projects
Other Stuff: Tutorials / Craft | Feedback & Critique Welcome!

Offline Suuper-san

  • Level 0 Writer
  • Hero Member
  • *****
  • Posts: 6040
  • Gender: Male
  • Anyone need a wall of text?
    • View Profile
Re: Suuper's Scripts
« Reply #1 on: March 15, 2020, 01:52:58 PM »
Anyways first script: A lineart softening GIMP script. See the first post on how to add GIMP scripts to your program.
This basically adds 2 blurred layers of the selected layer, sets them to multiply and then adjusts the opacity. If you have a single layer, you will need to add a white layer underneath it all otherwise your entire image will be partially transparent.

Here's a before and after


Code: [Select]
(define (script-suu-softlines image drawable)
  (let* (
(par (car (gimp-item-get-parent drawable)))
(pos (car (gimp-image-get-item-position image drawable)))
(lines1px (car (gimp-layer-copy drawable FALSE)))
(lines5px (car (gimp-layer-copy drawable FALSE)))
        )
(gimp-image-undo-group-start image)

(gimp-item-set-name lines1px "SoftLines 1px")
(gimp-item-set-name lines5px "SoftLines 5px")
(gimp-item-set-name drawable "SoftLines Original")

(gimp-image-insert-layer image lines1px par pos)
(gimp-image-insert-layer image lines5px par pos)

(plug-in-gauss RUN-NONINTERACTIVE image lines1px 1 1 0)
(plug-in-gauss RUN-NONINTERACTIVE image lines5px 5 5 0)

;(gimp-layer-set-mode drawable LAYER-MODE-MULTIPLY)
(gimp-layer-set-mode lines1px LAYER-MODE-MULTIPLY)
(gimp-layer-set-mode lines5px LAYER-MODE-MULTIPLY)

(gimp-layer-set-opacity drawable 40)
(gimp-layer-set-opacity lines1px 70)
(gimp-layer-set-opacity lines5px 100)

(gimp-image-undo-group-end image)

(gimp-displays-flush)
  )
)



(script-fu-register "script-suu-softlines"
  _"Soften Lines"
  _"Soften a lineart layer with multiple blurred layers"
  "Suuper"
  "Suuper, 2020"
  "Mar 2020"
  "*"
  SF-IMAGE      "Input Image"      0
  SF-DRAWABLE   "Input Drawable"   0
)

(script-fu-menu-register "script-suu-softlines"
                         "<Image>/SuuperSuite/Shortcuts")


To change the levels of blur you will have to alter the script manually, as adding options makes it just as slow as doing the blurring and new layers manually. The default is good for thinnish (~5-10px) linearts.

So to change the 5px blur to 10px, take this line and change it:
Code: [Select]
(plug-in-gauss RUN-NONINTERACTIVE image lines5px 5 5 0)
Code: [Select]
(plug-in-gauss RUN-NONINTERACTIVE image lines5px 10 10 0)
"lines5px" is the reference to the layer itself so that's just a name, don't change that.
« Last Edit: March 15, 2020, 05:10:28 PM by suuper-san »
Art: Manga / Fanart / Requests (closed) / Other Art | Manga Stories & Projects
Other Stuff: Tutorials / Craft | Feedback & Critique Welcome!

Offline Suuper-san

  • Level 0 Writer
  • Hero Member
  • *****
  • Posts: 6040
  • Gender: Male
  • Anyone need a wall of text?
    • View Profile
Re: Suuper's Scripts
« Reply #2 on: August 14, 2020, 05:07:59 AM »
Since Lego asked, and since this program is relatively safe to use, I've uploaded my little random generator program to use.



This program can generate random prompts from different lists of text, combining words from each list in an order/format you choose.

It can be as simple as just picking a ranomd item from a single list, or generating a full character description down to their hair and eye colour.

The only issue, if you can call it that, is that you have to get the lists yourself, it doesnt come with any preloaded. You can pretty much google lists of anyhting you want anyway.

here's the link on google drive:
https://drive.google.com/file/d/1I6sW1LlTk3Vb70MoaAbhCBKvgqc_t13O/view?usp=sharing

I recommend the tutorial otherwise you will have no idea how to use it:

Spoiler
Click the New button at the top to create a new project, or if you have made one already, click the drop down list an select it.
A "project" simply contains the lists for one type of prompt, but you can use a single project to generate multiple types of prompt, it's just how I started storing the data originally.


Give it a name


The project is now selected and opened


Underneath the word Variables, type a name for a "variable". This is just a name for a collection of words - a list.
Create one list called "color" and another called "shape"
Press "New" on the right, to create it


Select on the left the "color" from the list. Now on the right side, you can type your list of words, or copy and paste from Google etc. Populate the list with some generic values. Do the same for "shape" as well.



OK now select the "Phrase" option which was automatically created. Here's where you can combine lists
any word in square brackets is interpreted as a list, so the program will pick a random word from the named list when it generates the prompts.


Note that you can do this in any list, not just "Phrase". You can even put a reference to a list inside itself!
In this more complex instance, if the final option gets picked by the program, then it will open the list to find other colours.


At the bottom click "Random". This will give you a single prompt of the selected item. If you had just a list selected, it would pick a random word from the list.



To generate multiple prompts, use the two buttons at the bottom. The "text height px" refers to the height of prompts created in images only.
If you select the clipboard option, you will have to paste into notepad or something to see the results and save them.
Saving images saves to the default directory only, click "Open Directory" at the top to navigate to it.



You can create interesting prompts by combining adjectives in front of other words, but you still have to create/find each list of adjectives yourself.

Here is a more complex example of how I generate my normal prompts:
Spoiler
The "Phrase" variable uses the same list 4 times (a unique random item will be chosen each time where possible)


The "prompt" item contains references to all the other main lists


So the generated prompts are like so:
adjusting clothes , frilly coat , sweet lolita , orange
sunny , laughing , tired , shopping mall
daydreaming , town , confused , eating
happy , raining , bored , drinking

The program should autosave any changes you make when you close or change projects, but I added a save button because sometimes it doesn't and I don't know why. lol.

Ask if you have any queries or if you have any suggestions let me know!

Credit where credit is due - while I had this idea on my own, I ran into this awesome one a while back that was basically exactly what I was trying to create, it's better (also a bit more complex), but you can't download it, it's a webpage rather than a program. So I decided to make my own anyway.
https://orteil.dashnet.org/randomgen/
made by the guy who made cookie clicker if you remember that.
« Last Edit: August 14, 2020, 05:32:14 AM by Suuper-san »
Art: Manga / Fanart / Requests (closed) / Other Art | Manga Stories & Projects
Other Stuff: Tutorials / Craft | Feedback & Critique Welcome!

Offline legomaestro

  • High Chancellor of Righteousness
  • Global Moderator
  • Hero Member
  • *
  • Posts: 20370
  • Gender: Male
  • real life has wack graphics
    • View Profile
Re: Suuper's Scripts
« Reply #3 on: August 14, 2020, 05:22:40 AM »
Yesssssss domo harigatou.

And this totally reminds me of linguistics class because of the order of adjectives. It's something you learn automatically and makes too much sense when you see it listed down.


1.Quantity or number

2.Quality or opinion

3.Size

4.Age

5.Shape

6.Color

7.Proper adjective (often nationality, other place of origin, or material)

8.Purpose or qualifier


Definitely helps with this sort of generator. I've managed to get some prompts but yeah thanks for the tutorial. I'll tweak it a little and look forward to my next couple of days using this hehe

Offline Suuper-san

  • Level 0 Writer
  • Hero Member
  • *****
  • Posts: 6040
  • Gender: Male
  • Anyone need a wall of text?
    • View Profile
Re: Suuper's Scripts
« Reply #4 on: August 14, 2020, 05:34:20 AM »
ahhh yeah I was like wut? when I first realised I was doing the adjective order automatically haha.
hope it works nicely for you, let me know how it goes!
:D
Art: Manga / Fanart / Requests (closed) / Other Art | Manga Stories & Projects
Other Stuff: Tutorials / Craft | Feedback & Critique Welcome!