Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Change all colors in an image except black

  1. Dec 4, 2015 #1

    I have a typesetting software which can export typeset math as normal, nice looking black LaTeX text. However it always puts it on a white background. How can I change the background color of an image (png or jpeg) without changing the black text contained int he image? Should I write a script that can do this or is there already a tool to do so? I want the background of the picture to match the background of my poster.

  2. jcsd
  3. Dec 4, 2015 #2


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    It's possible to set the background of a jpeg to be transparent. I don't know what the capabilities of your software is though.
  4. Dec 4, 2015 #3


    Staff: Mentor

  5. Dec 4, 2015 #4
    I was thinking of writing a program to cycle through each pixel and convert it to the color I want, skipping the black pixels, but I don't know if that is overkill or if there is some other easy way to do it.

    Edit: cool...I will check that out
  6. Dec 6, 2015 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook