Change all colors in an image except black

  • Thread starter Thread starter Hercuflea
  • Start date Start date
  • Tags Tags
    Change Image
Click For Summary

Discussion Overview

The discussion revolves around changing the background color of an image while preserving black text. Participants explore various methods and tools that could achieve this, including scripting and existing software capabilities.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested

Main Points Raised

  • One participant inquires about methods to change the background color of an image without altering the black text, suggesting the need for a script or existing tool.
  • Another participant mentions the possibility of setting the background of a JPEG to be transparent, though they express uncertainty about the software's capabilities.
  • A suggestion is made to use Imagemagick, a collection of command-line tools for image manipulation, as a potential solution.
  • One participant considers writing a program to iterate through each pixel to change the background color while skipping black pixels, questioning whether this approach is necessary or if simpler methods exist.
  • Another participant references programs with a "magic wand" feature that can select regions matching a specific pixel color, implying this could be useful for the task.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach, as multiple methods and tools are proposed, and uncertainty remains about the capabilities of the software in question.

Contextual Notes

Limitations include the lack of clarity on the specific software capabilities and the potential complexity of the proposed pixel manipulation approach.

Hercuflea
Messages
593
Reaction score
49
Hello,

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.

Thanks
 
Computer science news on Phys.org
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.
 
  • Like
Likes   Reactions: jedishrfu
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
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
153K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
8
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
14K
  • · Replies 22 ·
Replies
22
Views
2K