1

I have a set of about 200 PNG-images in like that: Note

Only black and white, no colors, no grey.

I need the background color (white) to be removed and tried to do so in macOS Preview (with that Instant alpha tool), but the problem is that it just lets me remove connected white areas. But I also want to remove white between the lines and inside the note circle.

In short: every black pixel should stay black, every white pixel should be transparent. How can I do this without selecting every white area? I have mac Preview and GIMP, but other Freeware is possible too.

And the other thing: It is not a single image, but about 200 of that kind. Is there any way to automate the operation? E.g. with the GIMP Batch mode? (I have got no clue how to use it.)

PS: Is that question right on graphicdesign? I had no idea where to look else...

1 Answer 1

2

GIMP hasn't "action recording" like Photoshop. A programmer is needed to create a script for this. To process one image you should open the image, go to the interesting layer if there's more than one, insert alpha channel if there's not one present already, change the current foreground color to white and apply Layer > Transparency > Color to Alpha. The result has your black image against transparent background and ready to export as PNG.

enter image description here

Unfortunately I cannot write any properly working code to automate this. The same is true for other freeware. For example free or actually "pay what you like" web service Photopea could do your job. There one image needs inserting the image itself to the layer mask and inverting the mask. Then the result could be exported as PNG. Repeating the same automatically needs a programmed script, there's no "record the sequence" functionality.

2
  • 1
    Maybe ImageMagick could automate it. Related question here on stack overflow: stackoverflow.com/questions/26408022/…. Sadly, the complex answers given are way over my head. Maybe if we wait long enough @joojaa can chip in.
    – Billy Kerr
    Commented Dec 14, 2019 at 16:36
  • 1
    @BillyKerr IM can automate it. Rather simple matter to make a shell script from the answer you point to.
    – xenoid
    Commented Dec 14, 2019 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.