It is currently Fri Apr 19, 2024 1:49 am


All times are UTC - 5 hours [ DST ]



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

Joined: May 16, 2010
Posts: 14709
Location: USA
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
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 2:02 pm  (#2) 
Offline
Global Moderator
User avatar

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

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


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

Joined: Jun 22, 2010
Posts: 1171
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
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 3:49 pm  (#4) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
...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
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 4:05 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
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
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 4:54 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
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 372 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 342 times

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


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

Joined: Jun 22, 2010
Posts: 1171
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
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 5:33 pm  (#8) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
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?

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


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

Joined: Apr 23, 2010
Posts: 1553
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 ))

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


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

Joined: Jun 22, 2010
Posts: 1171
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 433 times
Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:18 pm  (#11) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
paynekj wrote:
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".

That is understandable, though my own preference is for the options to be in plain English* rather than a C name (e.g., "Normal" as opposed to "GIMP_NORMAL_MODE"). Also, there are a couple of paint modes ("Behind" and "Erase") that don't apply to layers.

* If the string constants were prefixed by an underscore (e.g., _"Normal"), then the words would automatically get translated to other languages; this would not be true for the names of GIMP's enumerated types.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:23 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Great!! :)

Trying it now.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:32 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Excellent! :)
Image

I have not tried the other modes yet but this works great. :bigthup

Thanks again.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:42 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
My Piranha Wolverine
Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:45 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Unsharp mask (2.85) on the normal text layer.

Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Script request
PostPosted: Fri Nov 04, 2011 6:53 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
New from visible -duplicated visible layer
set top layer to screen mode. :) :paint
Image :yes


These look totally awesome paynekj! I am very, very happy with this. :clap
Excellent job on the script.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Script request ( solved ) - thanks Paynekj, Saul, and Tux!
PostPosted: Fri Nov 04, 2011 8:32 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I love this script.This is a photo of a bridge in some woods my Wife and i frequent quite often for our walks.

Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Script request
PostPosted: Sat Nov 05, 2011 6:14 am  (#18) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
paynekj wrote:
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.

I didn't notice that user selection of the layer mode was part of the specifications, but more versatility is usually better. :hehe

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Script request ( solved ) - thanks Paynekj, Saul, and Tux!
PostPosted: Sat Nov 05, 2011 6:53 am  (#19) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Here is one that I made back in 2006 using this technique:

Image

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Script request ( solved ) - thanks Paynekj, Saul, and Tux!
PostPosted: Sat Nov 05, 2011 12:34 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Nice Rob! :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Script request

3

No new posts My shameful n00b request for help

3

No new posts Attachment(s) pm_create_a_water_drop_text.py (Issabella request) updated

17

No new posts Attachment(s) pm_plexi_text_effect plugin (Issabella request) version_2

13

No new posts Request- Make a scriptfu out of my X Window stroke outline hack

1


cron

* Login  



Powered by phpBB3 © phpBB Group