Follow ZDNET: Add us as a preferred source on Google.
ZDNET’s key takeaways
- Yellow sheet music backgrounds caused problems for playback apps.
- Artificial intelligence can most effectively serve as a code generator.
A command-line Python utility eliminated the PDF coloration.
Recently, my wife, Denise, began singing with the choir at her church. She has a beautiful voice. She needed to rehearse all the new pieces. The songs arrived in short booklets roughly the size of a trade paperback, printed on yellow stock. Her plan was to digitize those booklets into her computer as a PDF, strip out the color, and enlarge them on standard 8.5-by-11-inch paper to avoid needing reading glasses.
So one afternoon she asked me for help. She wanted to know how to erase the yellow background while keeping the musical notation intact, allowing her to print the pages without draining a massive quantity of color ink. Printing them in grayscale would still consume a lot of ink to produce a gray backdrop that would be even more difficult to read.
Also: How to use ChatGPT: A beginner’s guide to mastering OpenAI’s chatbot in 2026
She also planned to import the music into PlayScore 2, a program that plays back sheet music recordings so that performers can sing along. She was worried the software might have difficulty processing the colored background.
My first attempt was to use Photoshop to remove the yellow background, but the approach proved too cumbersome. Each image required slightly different adjustment settings. It was just too tedious and slow to continue that way.
So, I turned to ChatGPT instead. She already has a ChatGPT Plus plan, so it seemed worth trying.
Deterministic vs. non-deterministic
After running several test prompts such as:
Give me back a PDF I can download where the yellow background has been removed and replaced with white.
You did it correctly, but unfortunately, the text quality is very low resolution. Can you regenerate it in full resolution, please?
The tests were successful, but ChatGPT subtly modified the output PDFs. My wife feared that ChatGPT might alter the notes, lyrics, or some other detail of the original music. She didn’t want to practice from sight reading using an inaccurate version.
ChatGPT and other AI systems are “non-deterministic.” According to Webster’s, determinism means that “occurrences in nature, or social or psychological phenomena are causally determined by preceding events or natural laws.” Put simply, the input should always produce the same predictable output.
Also: This easy prompt trick gave me better AI-generated images – no matter the model
Traditional algorithmic programming, by contrast, is highly deterministic. Programs can certainly malfunction, but their behavior is ultimately foreseeable based on the specific code and variables involved.
AI systems are non-deterministic. This means you could submit the exact same input multiple times and receive different results each time. It’s somewhat like consulting a plumber or electrician. AI generates outputs based on complex probability calculations, so the results vary between executions.
Denise has encountered this unpredictability in her own use of ChatGPT. She was absolutely unwilling to hand over her music and receive a version where ChatGPT had taken creative liberties with the original.
She needed a background color removal tool that was completely deterministic.
Python can do that
For my final project in my Harvard Python certification course, I developed an interactive image management utility capable of applying individual Photoshop-like transformations and chaining them together in batches. So I knew Python contained the libraries necessary to accomplish what Denise needed.
Also: I stopped using ChatGPT for everything: These AI models beat it at research, coding, and more
However, I didn’t have the bandwidth to write a Python program from scratch. It was an extremely hectic week, with a long list of work projects demanding my attention.
Then again, ChatGPT has unlimited time. This is where the approach becomes clever. You can leverage a non-deterministic tool like ChatGPT to produce a deterministic program, such as a Python-based color removal utility. If you want a fascinating read on the distinction between AI determinism and non-determinism, check out this piece by former ZDNET writer Jason Perlow.
In any case, I decided to have ChatGPT write a Python script to handle the color removal. To build the script, I submitted this prompt and then headed to the kitchen to help my wife with dinner.
Write a python script that takes in a jpeg and sets any pixels that are not gray or black to white, saving it back out as name-decolor.jpg where name is the file name. Allow slightly tinted grays so that black text on a colored background will render properly as black text. Can you do the same thing if a PDF is presented? It also needs to work if the PDF is multiple pages.
By the time dinner was ready, so was ChatGPT. The initial version had a minor hiccup because I needed to install a Python library. But once that was resolved, it ran smoothly.
The tool is straightforward. You run the program decolor_pdf.py from the command line, passing it a single PDF file. It generates a new PDF with the background color stripped out.
% python decolor_pdf.py input.pdf
Does it work?
Yes, it does. If you’d like to grab a copy for yourself, it’s available in my GitHub repository. My wife was concerned about me using screenshots from the copyrighted church hymnals in this article, so I visited the New York Public Library’s website and downloaded a public domain song for demonstration purposes.
This is a song by jazz legend Fats Waller, who also composed several musicals. It’s a somewhat risqué tune, using horse racing metaphors to describe switching romantic partners. It was co-written with Andy Razaf, famous for penning lyrics to classics like “Ain’t Misbehavin'” and “Honeysuckle Rose”.
Helpful lessons
There are several useful takeaways from this experience.
- If you want AI’s assistance, you don’t always have to depend on non-deterministic processing. Sometimes, you can simply ask it to write you a program that operates on a reliable algorithm.
- You also don’t need to invest significant effort into designing a polished interface. Sometimes a basic command-line tool is all that’s required.
- Don’t hesitate to iterate on your specifications with the AI. Test what it produces and then request adjustments and improvements.
- Python is remarkably capable. With its vast library ecosystem, if you’re unsure which tool to use, Python is a solid choice.
So there you have it. If you need a quick fix for something, try asking ChatGPT to code it for you. It worked for me, and I was able to hand my wife a functional tool and help carve up a rotisserie chicken at the same time.
Also: I tested ChatGPT Images 2.0 vs. Gemini Nano Banana to see which is better – this model wins
Have you ever steered clear of using AI directly because you were concerned it might subtly alter the original file? Share your thoughts in the comments below.
You can follow my day-to-day project updates on social media. Be sure to subscribe to my weekly update newsletter, and follow me on Twitter/X at @DavidGewirtz, on Facebook at Facebook.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, on Bluesky at @DavidGewirtz.com, and on YouTube at YouTube.com/DavidGewirtzTV.



