Technology

He used ChatGPT, then trusted a Python script

deterministic Python – A fear that AI might subtly alter original music led one technologist to switch from ChatGPT to a command-line Python tool that removes yellow backgrounds from scanned sheet music PDFs without changing the notes—built with an AI-written script that runs determ

One afternoon, Denise walked in with a very specific problem—and a very specific worry.

Her church choir had just started singing new songs. The music arrived in booklets printed on bright yellow paper. and she wanted to scan those pages into her computer as PDFs. remove the yellow background. and then reprint the results larger on 8.5-by-11-inch paper. The goal wasn’t just aesthetics. She didn’t want to keep wearing reading glasses to see the notes.

She also wanted to avoid wasting color printer ink. Printing in black and white wouldn’t solve it, not really. A gray background would still draw ink and would be harder to read. And because she planned to feed the sheet music into PlayScore 2 to sing along. she was concerned the software might not react well to the original colored background.

At first, the obvious solution seemed to be image editing. The writer suggested removing the yellow background in Photoshop. It turned out to be too fiddly—each image needed slightly different slider settings, and the process became annoying and time consuming.

So he suggested ChatGPT. Denise has a ChatGPT Plus account, so it seemed like a reasonable shortcut.

He tested it with prompts that asked for a downloadable PDF with the yellow background removed and replaced with white, then followed up by requesting full resolution after noticing low text quality. The results were workable, but not what Denise needed.

The output had a problem that hit close to home: ChatGPT subtly altered the resulting PDFs.

Denise didn’t want to sight-read and practice wrong notes. She’d already experienced ChatGPT interactions that varied in ways she didn’t trust. The core issue, in his telling, is determinism.

He explained the difference this way: deterministic systems let the same input predict the same output, like traditional algorithmic programming. AI systems are non-deterministic—repeat the same input multiple times and you can get different results. The comparison he used was practical. almost domestic: it’s like “talking to a plumber or an electrician. ” where probabilities and variation can creep in.

For Denise, that meant she didn’t want to give ChatGPT her music and then discover that the tool took liberties with the masters.

His answer was not to abandon AI entirely, but to use it differently—turning it into a drafting partner for something deterministic.

For a Harvard Python programming certification. he had written an interactive image management tool that performed individual Photoshop-like image transformations and batch sequences. He knew Python had the libraries to accomplish what Denise wanted without relying on AI’s non-deterministic behavior.

It was also, in his words, a busy week—he didn’t have time to write the entire program from scratch. ChatGPT had the time, so he asked it to write the script that would remove color from the PDFs.

He started with a very clear instruction: 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. He also asked it to allow slightly tinted grays so black text on a colored background would still render properly as black text. Then he extended the request: can it do the same for a PDF, including multiple pages?.

By the time dinner was done, the script was ready.

The first version needed a library install, but after that it ran. The program could be executed from the command line using decolor_pdf.py, feeding it a single PDF file and outputting a new PDF with the background color removed. The command he used was:

% python decolor_pdf.py input.pdf

After running, he said it worked.

He also made the code available for others to download from his GitHub repo.

There was one more concern that stayed personal: Denise worried about the writer using screenshots from copyrighted church hymnals in the article. To demonstrate with a public domain song, she went to the New York Public Library’s website and grabbed a public domain piece.

The example song he chose is by jazz great Fats Waller, who also wrote several musicals. The song is a bit racy, using horse racing metaphors to describe changing lovers. It was co-written with Andy Razaf, known for writing lyrics to songs including “Ain’t Misbehavin’” and “Honeysuckle Rose.”

The story ends up being more than a workaround for yellow backgrounds. It’s a lesson about how to use AI without handing over trust.

He framed it as a shift: when you want reliability, you don’t have to rely on non-deterministic processing. Sometimes you can ask an AI to write a program that follows a reliable algorithm. You also don’t need a polished interface—his solution was a simple command-line tool. He suggested refining the specification with AI, then running and adjusting until it behaves the way you need.

Python, he said, does a lot, and it comes with many libraries—so if you’re unsure what tools to use, building with Python can get you where you want.

His final note mixed usefulness with the reality of his week: he gave Denise a workable tool and helped de-chickenelate a rotisserie chicken at the same time.

And for readers still wary of AI touching their original files. he left one question hanging at the end: have they avoided using AI directly because of fear it might subtly change the original file?. He pointed them to the comments. while also encouraging readers to follow his project updates. newsletter subscription. and social accounts—Facebook. Instagram. Bluesky. and YouTube—plus Twitter/X at @DavidGewirtz.

ChatGPT Python script PDF editor determinism non-deterministic AI sheet music PlayScore 2 cybersecurity-adjacent trust GitHub

4 Comments

  1. I don’t get why people keep using stuff like ChatGPT for anything visual. If it “alters” it, what are we even doing. Just use the dang scanner and settings right?

  2. Wait, was the Python script made by AI too? Like it’s still AI writing code so how is that not also gonna mess it up lol. Also PlayScore 2… isn’t that the one that already does notation detection?

  3. Denise just wanted the yellow paper gone and bigger so her choir can see it… and then ChatGPT supposedly “subtly altered” the PDFs? That sounds like a lawsuit waiting to happen. Next thing you know they’ll be like “oops the notes shifted a pixel” and the whole choir’s wrong. Also if it’s not changing the notes, why did it fail the first time, seems contradictory.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? Please solve:Captcha


Secret Link