It is currently Thu Oct 30, 2014 11:54 pm


Latest GIMP Scripts & Plug-ins

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Script request ( solved ) - thanks Paynekj, Saul, and Tux!
PostPosted: Fri Nov 04, 2011 2:52 pm  (#1) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 11495
Location: "Looking for my eraser" =P
I would like a script that would take normal text layers and turn them into a text art like this

You would open the script dialog and it gives you a few options
Select image layer (user input)
Select text layer (user input)
Select font ( sans default) - allow choice
Set line spacing (-6.0 default) - allow user input
Set bg color (black default) - allow to choose this color
Set color inverted text layer mode (grain extract default) - allow to choose
Upon hitting ok the script would do this -

1)Take the selected image and add an alpha channel if none exist.
2) Take the selected text layer and alpha to select it. -set line spacing
3) Select the image layer and copy paste new layer on top.(this copies text to new layer on top)
4) duplicate that layer and color invert it
5) set that color inverted layer to grain extract mode.
6) add a black layer on the bottom.
The user would have to make the original text type and image layers invisible unless the script could do this also.

Results
Image

_________________
Image
____________
OK, . . . . so what's the speed of dark?


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 3:02 pm  (#2) 
Offline
GimpChat Member

Joined: Oct 06, 2010
Posts: 2666
I second the request!

_________________
You cannot do a kindness too soon because you never know how soon it will be too late.

~Ralph Waldo Emerson


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 4:11 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 785
Location: Here and there
I've just tried your instructions manually, and I think you're missing something.

Where does the line spacing come into it? Have you missed a step that fills the image with text?

Kevin


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 4:49 pm  (#4) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5877
...and what text for the text ?
1) a user input i.e. "i must stop to write nonsense!" to repeat over and over
2) or just random letters ?

personally i will prefer the first

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 5:05 pm  (#5) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 11495
Location: "Looking for my eraser" =P
Quote:
...and what text for the text ?
1) a user input i.e. "i must stop to write nonsense!" to repeat over and over
2) or just random letters ?

personally i will prefer the first


No PC, the user input would be a text layer selection.The user would have already created the text on a layer by itself.Two layers would have already been created - image and text layer.Then you run the script.


Quote:
I've just tried your instructions manually, and I think you're missing something.

Where does the line spacing come into it? Have you missed a step that fills the image with text?

Kevin

Sorry Paynekj.Guess i didn't make that very clear. :)
I suppose the user could also have already set the line spacing. (width between the text lines)
When the text is copied and pasted into a new layer it actually copies the colored image as text.Basically you are just cookie cutting or cookie copying in this case. :hehe
Once you select the text (alpha to selection), you then select the image layer and select edit>copy>edit>paste into a new layer.That layer is then copied.Then it gets inverted Color>Invert
Then that inverted layer is set to grain extract.

_________________
Image
____________
OK, . . . . so what's the speed of dark?


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 5:54 pm  (#6) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 11495
Location: "Looking for my eraser" =P
Here is a xcf of type for you guys i created in Gimp-2.7.4
You can just use it for testing if you like.

Attachment:
type.xcf [1.29 MiB]
Downloaded 139 times


1500x1500 with line spacing set to -9.0

This is the result from that text with the same image.
Image

Here is the whole xcf file
Attachment:
type.xcf [3.79 MiB]
Downloaded 104 times

_________________
Image
____________
OK, . . . . so what's the speed of dark?


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:24 pm  (#7) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 785
Location: Here and there
So far I've got most of what you want working. Selecting the layer-mode is the challenge left as it's not a standard option for script-fu

Image

Kevin


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:33 pm  (#8) 
Offline
GC Founder/Coder
User avatar

Joined: May 22, 2008
Posts: 4702
Location: Gimpville
paynekj wrote:
Selecting the layer-mode is the challenge left as it's not a standard option for script-fu

Can't you use...

gimp-layer-set-mode

in Script-Fu?

_________________
Image
Even a man who is pure in heart and says his prayers by night, can
become a wolf, when the wolfbane blooms and the moon is full and bright.


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:54 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1303
Location: not from Guildford after all
paynekj wrote:
So far I've got most of what you want working. Selecting the layer-mode is the challenge left as it's not a standard option for script-fu

You can create a SF-OPTION drop-down that mimics the one in the Layers Dialog with the following registration:
SF-OPTION "Blend Mode" '( "Normal"     ; 0
                          "Dissolve"   ; 1
                          "Multiply"   ; 3
                          "Divide"     ; 15
                          "Screen"     ; 4
                          "Overlay"    ; 5
                          "Dodge"      ; 16
                          "Burn"       ; 17
                          "Hard light" ; 18
                          "Soft light" ; 19
                          "Grain extract" ; 20
                          "Grain merge" ; 21
                          "Difference" ; 6
                          "Addition"   ; 7
                          "Subtract"  ; 8
                          "Darken only" ; 9
                          "Lighten only" ; 10
                          "Hue" ; 11
                          "Saturation" ; 12
                          "Color" ; 13
                          "Value" ; 14
                          )


You then can use the requested mode as an index into an array that contains the GIMP's enumerated values for those modes (which I've shown as comments above).

(define (script-fu-some-script image layer blend-mode)
  (set! blend-mode (vector-ref #(0 1 3 15 4 5 16 17 18 19 20 21 6 7 8 9 10 11 12 13 14)
                                blend-mode ))

_________________
A man who does not read good books has no advantage over a man who cannot read them. -- Mark Twain


Top
 Profile  
 
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 7:04 pm  (#10) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 785
Location: Here and there
GnuTux wrote:
paynekj wrote:
Selecting the layer-mode is the challenge left as it's not a standard option for script-fu

Can't you use...

gimp-layer-set-mode

in Script-Fu?


Yes, but that's not the problem. It's in the user-interface. There isn't an equivalent to SF-COLOR, SF-FONT etc for the layer mode. BUT a quick bit of googling has lead me to the joys of SF-ENUM, for example:
SF-ENUM "Effect Layer mode" '("LayerModeEffects" "grain-extract-mode")

(For reference the SF-ENUM is in the Gimp Docs: http://docs.gimp.org/en/gimp-using-scri ... cript.html and I found the Gimp Enums defined here: http://developer.gimp.org/api/2.0/libgi ... enums.html and I had to guess the "enum value's nick. ")

Edit: I got Ninja'd by Saulgoode :ninja , but I prefer the SF-ENUM route as I then don't have to maintain a list of "magic numbers".


So I've attached my first go at this for you to try.
As I hate scripts burying themselves in the menus it's my standard practice to register my scripts in a "contributed" menu. You can edit it to suit yourself.


Attachments:
kp24_text_art.scm.gz [1.11 KiB]
Downloaded 215 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

* Login  

* Subscribe to Gimp Chat's RSS Feed    * Subscribe to Gimp Chat's Tutorial Feed    * Subscribe to Gimp Chat's G'MIC Feed


Powered by phpBB3 © phpBB Group