It is currently Mon Apr 15, 2024 8:06 am


All times are UTC - 5 hours [ DST ]


Switch to mobile style

Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Newbie question on adjusting brush size
PostPosted: Tue Aug 07, 2012 10:41 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jul 14, 2012
Posts: 20
There is something basic I'm missing. I use (gimp-context-set-brush-size). It changes the brush size in the tools option after the script is run, but when I go to use (gimp-paintbrush) it paints the default size for "Acrylic 01" which is 180 by 180.

(define (script-fu-acrylic-spot image drawable )

   (let*

       (
         (width (car (gimp-image-width image)))
         (height (car (gimp-image-height image)))
         (points (make-vector 2 'double))
         (x1 (* width 0.5))
         (y1 (* height 0.5))
         ;Brush size
         (brush-1 (* width 0.3))
         
        )

;undo
(gimp-image-undo-group-start image)
;undo

             (gimp-palette-set-foreground '(0 0 0))
             (gimp-context-set-brush "Acrylic 01")
             (gimp-context-set-brush-size brush-1)
                         
             (vector-set! points 0 x1)
             (vector-set! points 1 y1)
                       
             (gimp-paintbrush drawable 0 2 points PAINT-CONSTANT 0)
               
;undo
(gimp-image-undo-group-end image)
(gimp-displays-flush)
;undo
   ) 
   
)

(script-fu-register "script-fu-acrylic-spot"
            "<Image>/Filters/acrylic spot"
            "Testing Script"
            "PD"   
            "PD"   
            "2012"
            ""           
            SF-IMAGE "image" 0
            SF-DRAWABLE "drawable" 0
           
)


Sorry. I have a gut feeling the answer is quite simple. To my defense I spent quite a bit of time on Google looking for the answer and the only thing that came close was that I have to create a whole new brush using (gimp-brush-new) but that seems like overkill for a simple task like this.

Thank you for any input!


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: Newbie question on adjusting brush size
PostPosted: Wed Aug 08, 2012 12:14 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
I have my brush size set up to be accessed with the mouse scroll button when Ctrl + Alt is being pressed.

You can access this by clicking [Preferences] [Input Devices] [Input Controllers] and then choosing these options.

I like the way this works.

Also note the Scroll Down [View-soom-in] This lets me [mouse scroll button] zoom in and out super easily.

Image

Alan


Top
 Post subject: Re: Newbie question on adjusting brush size
PostPosted: Wed Aug 08, 2012 1:06 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jul 14, 2012
Posts: 20
Sorry. Maybe my post was confusing or unspecific. I am writing a script that works on open images and will ultimately add random blotches and the like, but as I mentioned, in my test script (gimp-context-set-brush-size) changes the brush size, but when the script gets to the point of drawing the brush size doesn't work. It just draws the brushes default size of 180 by 180. Am I missing a function in my script?

Thank you.


Top
 Post subject: Re: Newbie question on adjusting brush size
PostPosted: Wed Aug 08, 2012 3:24 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I created a new brush within the script and that worked (it sized okay).
Have you tried any other brush other than a Gimp Image Hose?

             (gimp-palette-set-foreground '(0 0 0))
             (gimp-brush-new "New_RD_Brush")
             (gimp-brushes-refresh)
             (gimp-context-set-brush "New_RD_Brush")
             (gimp-context-set-brush-size brush-1)

_________________
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: Newbie question on adjusting brush size
PostPosted: Wed Aug 08, 2012 3:08 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jul 14, 2012
Posts: 20
I've tried using other brushes. just tried using "2. Hardness 075". Script still changes the size in the "Tool Options", but when it goes to draw it uses the default brush size. In this case, 51 x 51.

I didn't have this problem with (gimp-context-set-brush-angle angle) when I used it in a different script. I only mention this because (gimp-context-set-brush-angle angle) & (gimp-context-set-brush-size size) appear to function similarly.

I'm a little confused about your newly created brush. Are all the brush details in (let*)? or are you calling on a brush you've previously created?

This problem I'm having is really annoying. From my inexperienced point of view, if I change the brush size, it should simply draw that new brush size.

Anyways, still need help. Any input is immensely appreciated.


Top
 Post subject: Re: Newbie question on adjusting brush size
PostPosted: Thu Aug 09, 2012 2:27 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
As posted on the mailing list, this is probably a (longstanding) bug.

(gimp-context-set-brush-size brush ) seems to only work on parametric brushes, not those based on images (.gbr, .gih, or imported .abr files)

Do you need to change the brush size often in the script? One work-around is opening the brush file, scaling it, then saving it as another brush file, refreshing the brushes and than using that (ugh). A somewhat less painful workaround is to draw with the brush on a blank canvas the size of the brush, scale as needed then select all and copy into the clipboard. Then use the clipboard brush.

Neither of those will work with animated brushes/gimp image hoses.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Newbie question on adjusting brush size
PostPosted: Mon Aug 13, 2012 1:46 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Jul 14, 2012
Posts: 20
Just to clarify so I can move on knowing what I can and can not do within a script. I understand I can open gimp, choose a brush, scale it up/down and save as a new brush which I could then use within my script. However, I'm making my scripts universal. So anyone who installed gimp 2.8 could then use my script.

So with that in mind, my understanding is that I can only make size adjustments in my scripts to parametric brushes. All other brushes I'm stuck using the brushes default size.


Top
 Post subject: Re: Newbie question on adjusting brush size
PostPosted: Tue Aug 14, 2012 11:32 am  (#8) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Phoenix999 wrote:
Just to clarify so I can move on knowing what I can and can not do within a script. I understand I can open gimp, choose a brush, scale it up/down and save as a new brush which I could then use within my script. However, I'm making my scripts universal. So anyone who installed gimp 2.8 could then use my script.

So with that in mind, my understanding is that I can only make size adjustments in my scripts to parametric brushes. All other brushes I'm stuck using the brushes default size.



when I said

Quote:
One work-around is opening the brush file, scaling it, then saving it as another brush file, refreshing the brushes and than using that (ugh). A somewhat less painful workaround is to draw with the brush on a blank canvas the size of the brush, scale as needed then select all and copy into the clipboard. Then use the clipboard brush.


I meant your script could do this to overcome the inability to scale a non-parametric brush.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Newbie question on adjusting brush size
PostPosted: Thu Aug 16, 2012 1:52 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Jul 14, 2012
Posts: 20
Thanks for responding and please excuse my inexperience. I really have put in the hours trying to work this out. I should mention I'm using windows and Gimp 2.8. I'm not certain, but I think the Linux version has more hands on board. So it may work a little better. I don't know. I'm just throwing that out there.

Quote:
One work-around is opening the brush file, scaling it, then saving it as another brush file, refreshing the brushes and than using that (ugh)


To clarify, my script is running in an open image. For example, 2000 by 2000 pixels. I've looked through the PDB and I see using:

(gimp-context-set-brush name)
(gimp-context-set-brush-size size)

But from here, I can't see how to save the new brush. So then I'm thinking you mean using:

(file-gih-load) ;because I'm using "Acrylic 01" which is a hose (which I just learned)

some commands in here (to which I'm clueless) and then:

(file-gbr-save)

Through my Googling, I've crossed paths with posts made by you going back more than 5 years. I hate to trouble you with something so simplistic.

Quote:
A somewhat less painful workaround is to draw with the brush on a blank canvas the size of the brush, scale as needed then select all and copy into the clipboard. Then use the clipboard brush.


Yes. This is what I've ended up doing. Regretfully, the clipboard maxes out at 512 by 512, but I simply used (script-fu-paste-as-brush) instead. Thanks for heading me in that direction because you would have had a good laugh at the ridiculous mess I made trying to set out to do what I wanted to do.

I think I should wait a little while before putting my application in to Google. :hoh If there were Razzies for Script-fu, I'd definitely be nominated.

P.S. Do you know anyone on the registry.gimp.org board. I've tried to register, but I'm not getting the confirmation request. I've set my email not to block them but still nothing received.


Top
 Post subject: Re: Newbie question on adjusting brush size
PostPosted: Thu Aug 16, 2012 11:54 am  (#10) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Phoenix999 wrote:
Thanks for responding and please excuse my inexperience.


That's why we're here!

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) GIMP size question

4

No new posts Brush Size no where to be found. Disappeared.

2

No new posts BRUSH SIZE REDUCE AND ENLARGE (Solved)

7

No new posts Color Adjusting Help

1

No new posts Performance of adjusting layers and exporting with Python Fu

5



* Login  



Powered by phpBB3 © phpBB Group