It is currently Tue Jul 02, 2024 1:34 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: FROM GBR FILE TO ABR FILE
PostPosted: Thu May 11, 2023 9:12 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Apr 26, 2014
Posts: 3543
Location: belgium
I would like to convert a gbr file from my gimp brushes to an abr file so that I can also use the brush in photoshop.
how can i simply convert that, can anyone give me the correct way.
thanks in advance, gimper66


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Gimp brush .gbr to Adobe PhotoShop .abr?
PostPosted: Thu May 11, 2023 4:28 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Oct 23, 2021
Posts: 67
Hello Gimper66

Gimp brush .gbr to Adobe PhotoShop .abr?

PhotoShop .abr could be read :blind by Gimp, AbrMate, XnConvert.
However, you need PhotoShop to save a brush in the proprietary format .abr :oops:

Reference: "How to create .abr without using PS?" answered by rich2005 in 2020.

Attachment:
OpenBrushAsImage.png
OpenBrushAsImage.png [ 110.5 KiB | Viewed 1342 times ]

In Gimp Brush window (Shift+Ctrl+B):

  1. Right click a black on white grayscale brush .gbr or multiple colored image hoses .gih or parametric .vbr
  2. Contextual menu "Open as image".
  3. "File" > "Export as" renaming .gbr or .gih or .vbr to .png

In PhotoShop:

  1. Open .png
  2. Be sure that .png is black on white. Otherwise "Image" > "Adjustments" > "Invert"
  3. "Edit" > "Define Brush Preset"


Last edited by AlSchemist on Sun May 14, 2023 5:55 am, edited 4 times in total.

Top
 Post subject: Gimp brush in the Script-Fu console
PostPosted: Thu May 11, 2023 4:33 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Oct 23, 2021
Posts: 67
Gimp brush in the Script-Fu console

Gimp menu "Filters" > "Script-Fu" > "Console" Alt+R S C :geek
Copy and paste the following in the input box of the Script-Fu console.
Note the regular expression suffix ".*" meaning match everything in the filename without the file extension.
(gimp-brushes-get-list "Chalk.*")

Gimp Script-Fu could reply:
(5 ("Chalk 02 copy" "Chalk-02-copy" "Chalk 01" "Chalk 02" "Chalk 03"))

The first copy has been created from .gbr while the 2nd could be a .gih

Chalk-02-copy.gbr: 52 Kb grayscale black on white background
Chalk-02-copy.gih: 259 Kb colored brush having a little red triangle in lower right corner
Chalk-02-copy.png: 18 Kb compressed grayscale

Retrieve width, height, mask-bpp, color-bpp of the named brush:
(gimp-brush-get-info "Chalk 02 copy")

(230 230 1 0)

To get all brushes, indicate the empty string:
(gimp-brushes-get-list "")

(60 ("Clipboard Image" "Clipboard Mask" "Chalk 02 copy" "Chalk-02-copy" "1. Pixel" "2. Block 01" "2. Block 02" "2. Block 03" "2. Hardness 025" "2. Hardness 050" "2. Hardness 075" "2. Hardness 100" "2. Star" "Acrylic 01" "Acrylic 02" "Acrylic 03" "Acrylic 04" "Acrylic 05 #2" "Animated Confetti" "Bristles 01" "Bristles 02" "Bristles 03" "Cell 01" "Cell 02" "Chalk 01" "Chalk 02" "Chalk 03" "Charcoal 01" "Charcoal 02" "Charcoal 03" "Confetti" "GEGL goat" "Grass" "Grunge 01" "Hatch Pen 01" "Oils 01" "Oils 02" "Oils 03" "Pencil 01" "Pencil 02" "Pencil 03" "Pencil Scratch" "Pixel (1x1 square)" "Smoke" "Sparks" "Splats 01" "Splats 02" "Sponge 01" "Sponge 02" "Stone Work 01" "Texture 01" "Texture 02" "Texture Hose 01" "Texture Hose 02" "Texture Hose 03" "Vegetation 01" "Vegetation 02" "Vine" "Wilber" "z Pepper"))

The brushes of the user called "YourUserName" are in:
C:\Users\YourUserName\AppData\Roaming\GIMP\2.10\brushes


The folders of brushes installed with Gimp can be retrieved with the following function:
; Retrieve the list of subfolders in strPath
(define (list-folder strPath)
    (let*   (   (lenPath    (if (string? strPath) (+ (string-length strPath) 1) ; length after the last DIR-SEPARATOR
                                (error "7000 list-folder requires strPath as a string")
                )           )
                (lstGlob    (file-glob (string-append strPath DIR-SEPARATOR "*") 0))
                (lstFull    (if (and (list? lstGlob) (= (length lstGlob) 2)) ; file-glob returns (nbrDir lstFull)
                                (cadr lstGlob) ; Extract lstFull in 2nd position of lstGlob
                                (error "7010 list-folder cannot retrieve subfolders of " strPath)
            )   )           )
        (let loop   (   (lstFolder lstFull) ; List of full paths of subdirectories
                        (lstDir '()) ; List of subdirectories without the full path
                    )
            (if (not(pair? lstFolder)) (reverse lstDir) ; Restore the alphabetic order
                (loop (cdr lstFolder) (cons (substring (car lstFolder) lenPath) lstDir)) ; Cut the full path
)   )   )   )


(list-folder (string-append gimp-data-directory DIR-SEPARATOR "brushes"))

("Basic" "Fun" "gimp-obsolete-files" "Legacy" "Media" "Sketch" "Splatters" "Texture") :coolguy


Last edited by AlSchemist on Sun May 14, 2023 5:56 am, edited 6 times in total.

Top
 Post subject: Advanced Gimp Script-Fu or Python script about brushes
PostPosted: Thu May 11, 2023 4:37 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Oct 23, 2021
Posts: 67
Advanced Gimp Script-Fu or Python script about brushes

There are mainly script to save .gbr or use brush: :present

  1. kward1979uk_brush_batch.scm: Turns a folder of files into brush's works with jpg, bmp, xcf, png and gif by Karl Ward in 2006
  2. kward1979uk_quick_brush.scm: Speeds up layer flatten, desaturate and convert to grayscale by Karl Ward in 2005
  3. rotateBrush.scm: Resize Rotate a brush, Base on resizebrush.scm by Michael Hoelzen. Supplied by James Huang in 2008
  4. script-fu-paste-as-brush.scm: Paste the clipboard contents into a new brush by Michael Natterer in 2005
  5. density-brush-fill-0.2.py: Fill with brush strokes to density by Ofnuts in 2011

However, I did not test these scripts. Consider them as a starting point to script brushes.

How to export a brush as .png in Script-Fu?

You need to install KodiSave.scm or copy and paste the function PathSplit.
; (Export-gbr-to-png  "C:\\Tool\\Gimp\\forum\\GimpChat\\Brush\\Chalk-02-copy.gbr")
(define (Export-gbr-to-png fileGbr)
    (let*   (   (imgGbr     (car (file-gbr-load RUN-NONINTERACTIVE fileGbr fileGbr)))
                (layer      (car (gimp-image-get-active-drawable imgGbr)))
                (vPath      (PathSplit fileGbr)) ; See KodiSave.scm
                (pathPic    (vector-ref vPath 1)) ; 0-based element in the vector
                (filename   (vector-ref vPath 2))
                (lstFile    (strbreakup filename ".")) ; split the filename into the basename and the fileExt
                (basename   (car lstFile))
                (filePng    (string-append pathPic DIR-SEPARATOR basename ".png"))
            )
        (gimp-display-new imgGbr)
        (file-png-save RUN-NONINTERACTIVE imgGbr layer filePng filePng 0 9 0 0 0 0 0)
        (gimp-image-clean-all imgGbr)
        (displayln (string-append "Export-gbr-to-png SUCCESSFULLY exported \"" basename "\".gbr to " filePng))
)  )


In Windows, in the Script-Fu console, if your brush Chalk-02-copy.gbr is in C:\Tool\Gimp\forum\GimpChat\Brush, run:
(Export-gbr-to-png  "C:\\Tool\\Gimp\\forum\\GimpChat\\Brush\\Chalk-02-copy.gbr")

Gimp Script-Fu will reply:
Export-gbr-to-png SUCCESSFULLY exported "Chalk-02-copy".gbr to C:\Tool\Gimp\forum\GimpChat\Brush\Chalk-02-copy.png
#t

At the time of this writing, you are able to view the brush opened as image in the Gimp editor.
You need to manually close the brush .gbr by Ctrl+W after the export to .png

Once you got the .png, you can import it in PhotoShop to create .abr :hi5


Last edited by AlSchemist on Sun May 14, 2023 5:57 am, edited 4 times in total.

Top
 Post subject: Re: FROM GBR FILE TO ABR FILE
PostPosted: Fri May 12, 2023 1:59 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
This Doesn't answer Gimper's question ...

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Exporting a grayscale .gbr brush as .png in Gimp Script-Fu
PostPosted: Sat May 13, 2023 3:59 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Oct 23, 2021
Posts: 67
Hi Nelo, as an AI language model would claim, you are right. :yesnod
There is not a simple way :lmao to convert Gimp brush .gbr to Adobe PhotoShop brush .abr

Beginning by a negative sentence is an obvious shibboleth that does not help. :roll:

Three teams of developpers of the softwares quoted in #2 were able to design an .abr reader probably in a compiled high level language such as C++ or C. :jumpclap
However they all decided to not publish :rofl the feature of writing a brush in .abr format.
What could we expect with the prehistoric interpreted language Script-Fu, mainly when the problem of the writing of an .abr is not technical? :shock:

Exporting a grayscale .gbr brush as .png in Gimp Script-Fu
Attachment:
ExportGbrToPng.png
ExportGbrToPng.png [ 143.29 KiB | Viewed 1342 times ]

Anyway in the following version of the export of .gbr to .png, there is no need to close manually the .gbr by Ctrl+W.

:drum Introducing Export-gbr-to-png 2.0 :drum
; Gimp Script-Fu exports brush .gbr as .png with the idea to import .png in PhotoShop to build brush .abr
(define (Export-gbr-to-png fileGbr) ; Export brush .gbr as .png
    (let*   (   (vPath      (PathSplit fileGbr)) ; See KodiSave.scm
                (pathPic    (vector-ref vPath 1)) ; 0-based element in the vector
                (filename   (vector-ref vPath 2))
                (lstFile    (strbreakup filename ".")) ; split the filename into the basename and the fileExt
                (basename   (car lstFile))
                (filePng    (string-append pathPic DIR-SEPARATOR basename ".png"))
                (imgPng     (car (gimp-image-new 1 1 GRAY)))
                (layPng     (car (gimp-layer-new imgPng 1 1 GRAY-IMAGE "layer main" 100 LAYER-MODE-NORMAL-LEGACY)))
                (imgGbr     (car (gimp-file-load-layer 1 imgPng fileGbr))) ; load the brush .gbr
            )
        (gimp-image-insert-layer imgPng layPng 0 0) ; top of layer stack
        (gimp-image-insert-layer imgPng imgGbr 0 0) ; insert .brush as layer
        (script-fu-util-image-resize-from-layer imgPng imgGbr) ; resize .png to the brush size
        (gimp-layer-resize-to-image-size layPng)               ; also its layer
        (set! layPng (car (gimp-image-flatten imgPng)))        ; merge layer .png and layer .gbr
        (file-png-save RUN-NONINTERACTIVE imgPng layPng filePng filePng 0 9 0 0 0 0 0) ; save as .png
        (gimp-image-clean-all imgPng) ; clean-up
        (gimp-image-delete imgPng) ; you can close the exported .png
        (displayln (string-append "Export-gbr-to-png SUCCESSFULLY exported \"" basename ".gbr\" to " filePng))
)  )

Also, copy and paste the function PathSplit from KodiSave.scm or hereafter enclosed: :geek
; (PathSplit "")
; Error: 4500 PathSplit: the path cannot be empty

; (PathSplit "C")
; Error: 4510 PathSplit: the path should have more than one character

; (PathSplit "NoDrive")
; Error: 4520 PathSplit: the path contains an unsupported separator of folders

; (PathSplit "C:")
; #("C:" "" "")

; (PathSplit "C:\\")
; #("C:" "" "")

; (PathSplit "C:\\Tool\\Gimp\\forum\\GimpChat\\SaveXcf-ExportPng")
; #("C:" "C:\\Tool\\Gimp\\forum\\GimpChat" "SaveXcf-ExportPng")

; (PathSplit "C:\\Tool\\Gimp\\forum\\GimpChat\\SaveXcf-ExportPng\\")
; #("C:" "C:\\Tool\\Gimp\\forum\\GimpChat" "SaveXcf-ExportPng")

; (PathSplit "C:\\Tool\\Gimp\\forum\\GimpChat\\SaveXcf-ExportPng\\_GamerOfThrone1.png")
; #("C:" "C:\\Tool\\Gimp\\forum\\GimpChat\\SaveXcf-ExportPng" "_GamerOfThrone1.png")

; (PathSplit "C:\Tool\Gimp\forum\GimpChat\SaveXcf-ExportPng\TV Shows\Gamer of Throne (2011)\_GamerOfThrone1.png")
; Error: 4520 PathSplit: the path contains an unsupported separator of folders

; (PathSplit "C:/Tool/Gimp/forum/GimpChat/SaveXcf-ExportPng/TV Shows/Gamer of Throne (2011)/_GamerOfThrone1.png")
; Error: 4520 PathSplit: the path contains an unsupported separator of folders

; Split a full path returning a vector containing: the drive such as "C:", the parent folder and the basename:
; If the path ends by a filename, the basename if this filename. Otherwise the basename is the last folder of the path.
;                  string
(define (PathSplit path)
    (let*   (   (lenDir     (string-length path)))
        (if (zero? lenDir) (throw "4500 PathSplit: the path cannot be empty"))
        (if (< lenDir 2)   (throw "4510 PathSplit: the path should have more than one character"))
        (let*   (   (idxLast    (- lenDir 1)) ; index of the last character in the path
                    (isLastSep? (char=? (string-ref path idxLast) (string-ref DIR-SEPARATOR 0)))
                    (strDir     (if isLastSep? ; If the path ends with the DIR-SEPARATOR
                                    (substring path 0 idxLast) ; Remove ending DIR-SEPARATOR
                                    path ; else keep the path unchanged
                )   )           )
            (if isLastSep? (set! idxLast (- idxLast 1))) ; Since the last DIR-SEPARATOR has been removed, decrement idxLast
            (if (char=? (string-ref strDir idxLast) #\:) ; Does the path end with the drive separator ":"?
                (vector strDir "" "") ; The parent of the root folder is the root folder. The current folder is empty
                (let*   (   (lstPath    (strbreakup strDir DIR-SEPARATOR)) ; Otherwise split the path removing each DIR-SEPARATOR
                            (lstDir     (reverse (cdr (reverse lstPath)))) ; remove the last folder from lstPath
                            (parent     (if (zero? (length lstDir))
                                            (throw "4520 PathSplit: the path contains an unsupported separator of folders")
                                            (unbreakupstr lstDir DIR-SEPARATOR)) ; Rebuild the parent without the last folder
                                        )
                            (basename   (carDbg (last lstPath) 'PathSplit1 path)) ; basename is the last string of lstPath
                            (drive      (carDbg lstPath        'PathSplit2 path))
                        )
                    (vector drive parent basename) ; return a vector: basename could be either the last folder or the filename.
)   )   )   )   )

Run in Windows doubling each backslash of the .gbr full path :
(Export-gbr-to-png  "C:\\Tool\\Gimp\\forum\\GimpChat\\Brush\\Chalk-02-copy.gbr")

Export-gbr-to-png SUCCESSFULLY exported "Chalk-02-copy.gbr" to C:\Tool\Gimp\forum\GimpChat\Brush\Chalk-02-copy.png
#t


Top
 Post subject: Re: FROM GBR FILE TO ABR FILE
PostPosted: Tue May 16, 2023 4:37 am  (#7) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2436
I smell a ChatGPT

AFAIK no such Gimp Brush Converter plugin. Certainly not in the old defunct plugin registry site. There is the abr.exe plugin to convert abr brushes to gbr but nothing the other way round.

The only way is using Photoshop to add an image to a brush collection.

_________________
Image


Top
 Post subject: Re: FROM GBR FILE TO ABR FILE
PostPosted: Tue May 16, 2023 4:40 am  (#8) 
Offline
Global Moderator
User avatar

Joined: Oct 02, 2014
Posts: 4513
Location: Sydney Australia
@Rich2005 -relevant post now deleted.

_________________
Image

Respect should be offered freely but hard earned


Top
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts "New"file replacing "open" file?

2

No new posts GIH FILE

2

No new posts Attachment(s) csh file [Solved]

3

No new posts Anyone have an exe file of GMIC 1.79 64 bit?

0

No new posts Attachment(s) Image to bit map file

7



* Login  



Powered by phpBB3 © phpBB Group