Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Batch converting images as brushes
#1
I have 150 png images with transparency.
They come from a PS .abr file i exported to single png files with a program called abrMate.

I did this because i dont need all the brushes but only some.


How do i batch convert 150 files/layers at once so they are converted to grayscale and a white background is added ?

I have Bimp installed but that doesnt seem to do what i want.
Is there no plug-in/script that exports abr files as Gimp brushes ?
Reply
#2
(10-03-2019, 11:16 AM)Espermaschine Wrote: I have 150 png images with transparency.
They come from a PS .abr file i exported to single png files with a program called abrMate.

I did this because i dont need all the brushes but only some.


How do i batch convert 150 files/layers at once so they are converted to grayscale and a white background is added ?

I have Bimp installed but that doesnt seem to do what i want.
Is there no plug-in/script that exports abr files as Gimp brushes ?

  1. Use my interleave-layers script to add a white background to each layer
  2. Image>Mode>Grayscale
Then, things get a bit sticky because the default file-save that I use in a script doesn't work on GBR because each file wants a spacing. If you aren't too much of a hurry I can make a GBR-specific derivative of my script.
Reply
#3
(10-03-2019, 12:07 PM)Ofnuts Wrote:
  1. Use my interleave-layers script to add a white background to each layer
  2. Image>Mode>Grayscale

Im not quite sure how this works.
I got the plug-in installed.

Opened the biggest image first, then the rest as layers (they are all different sizes).
Which one is the correct option ?
I tried the Sprite option and it almost crashed Gimp 2.10.
When it finally finished, all layers were the same size...


Cant i just remove the alpha channel with Bimp to get a white background ?
I was able to find 'convert to grayscale' in Bimp but no remove alpha channel....

Btw, this is the abr file im talking about:
https://www.deviantart.com/wavenwater/ar...-620635993

Here are the transparent png's for testing purposes (8,22MB):
https://www.mediafire.com/file/ickdk7mln...p.zip/file




EDIT:
i solved the problem like this:
changed the display of transparency to white in the Preferences of Gimp 2.10.
Impoted biggest png first, then the rest as layers.
Changed Mode to Grayscale
Exported all layers as gbr.
The downside is: Gimp exports all brushes with the same Spacing, but thats allright in this case.

Still it would be great to have a script that does all this with more options.
Reply
#4
Here is something that may be useful to you. The attached will open a .abr file as layers in Gimp. Works on many (but not all) .abr files.

Put the 2 files in your plug-ins folder. Then use File > Open to open the .abr

EDIT: Gimp opens the .abr as a grayscale image and each layer is on a white background.


Attached Files
.zip   Open-abr-as-layers.zip (Size: 15.04 KB / Downloads: 212)
Reply
#5
Nice one - thank you Blighty !
Reply
#6
That was a struggle. The first part was easy. Remove the transparency in batch. ImageMagick does it in place.

Code:
Mogrify -flatten *.png

I know that XnView/XnConvert has the option to write to Gimp .gbr format, what could be easier. Tried all ways and Gimp rejects the grayscale .gbr files as wrong format.

Never-Give-Up.
There is an old script batch_brushes.scm that does what it says. Unfortunately not with Gimp 2.10, the gbr writing has gone from a separate plugin to an internal procedure. Tried rewriting the script but that needs one of the clever guys.

What does work is Gimp 2.8 (or using Gimp 2.10 after adding the 2.8 file-gbr plugin) Converted those 137 files to grayscale brushes. The only thing not set is the spacing, which is one. Tried out in Gimp 2.10.12 all working and take FG colour.

Zipped 137 .gbr brushes + script 5MB https://my.pcloud.com/publink/show?code=...InULjfKnzX
Reply
#7
Im still confused by the fact that you cant remove the alpha channel in Bimp.
Surely that procedure exists ?
Reply
#8
If it is not in the Gimp Procedure Browser then BIMP will not 'see' it. (Layers -> Transparency ->) Remove Alpha Channel for what ever reason is not in the procedure Browser. You might hope that gimp-image-remove-channel, which is in the Procedure browser might be used. Nope BIMP does not see it.

What it does see is gimp-image-flatten. That would go into BIMP as Other Gimp Procedure The result not as well defined as IM but it sort of keeps semi-transparency as a lighter gray. The problem with BIMP is it does not write to .gbr format

Edit: Something like this in BIMP - Gimp Other Procedure, flatten gets the white background - Color Corrections gets it grayscale. Still has an alpha channel (not able to do that Wink ) https://i.imgur.com/yF8wLLn.jpg
Reply
#9
Its all very complicated for such a seemingly trivial task...

A reddit user shared a python script for batch removing alpha, but i got an error in 2.8 and a brownish background in 2.10...

https://www.reddit.com/r/GIMP/comments/x...of_images/


@rich2005: not sure about your comment on exporting as .gbr, i can export multiple layers as .gbr with no problem (export layers py script),
the only drawback is, all i can do is define Spacing for all brushes at once. So they all have the same Spacing.
Reply
#10
Quote:A reddit user shared a python script for batch removing alpha, but i got an error in 2.8 and a brownish background in 2.10...
https://www.reddit.com/r/GIMP/comments/x...of_images/

From 2012 You did better than me, does not run in my linux Gimp(s) However the code uses pdb.gimp_layer_flatten so no different from that BIMP procedure.

Quote:@rich2005: not sure about your comment on exporting as .gbr, i can export multiple layers as .gbr with no problem (export layers py script)

It was just information concerning BIMP built-in procedures which has limited exporting formats : bmp , gif , ico , jpg , png , tga , tif , heif , webp

You can always export to jpeg and lose the transparency that way.

edit: Good fun this, better than a crossword Wink I did get that reddit script working in Gimp 2.10.12 It does flatten the images but leaves them as RGB.
Reply


Forum Jump: