
Observe ZDNET: Add us as a preferred source on Google.
ZDNET’s key takeaways
- Yellow sheet music can confuse playback apps.
- A command-line Python script solved the PDF drawback.
- Typically AI is finest used to put in writing the software.
Just lately, my spouse, Denise, began singing along with her church’s choir. She has a stunning singing voice. She wanted to observe all the brand new songs. The songs got here in booklets, concerning the dimension of a commerce paperback, printed on yellow paper. She needed to scan these booklets into her laptop as a PDF, take away the colour, and reprint them bigger, on 8.5-by-11-inch paper so she would not must put on her studying glasses to see them.
So one afternoon she got here to me. She requested how she might take away the yellow background, however protect the music itself, in order that she might print it out with out losing an enormous quantity of colour printer ink. If she printed it out in black and white, she’d nonetheless be utilizing quite a lot of ink to print out a grey background, which might be even tougher to see.
Additionally: How to use ChatGPT: A beginner’s guide to mastering OpenAI’s chatbot in 2026
She was additionally planning to feed the music into PlayScore 2, an app that performs the sheet music so that you could sing alongside to it. She was involved the software program won’t just like the background colour.
I initially urged eradicating the yellow background in Photoshop, however the process turned out to be too fiddly. Every picture wanted barely completely different slider settings. It was simply too annoying and time consuming to do it that means.
So, I urged she use ChatGPT. She has a ChatGPT Plus account, so this appeared like a good possibility.
Deterministic vs. non-deterministic
I did some checks, utilizing prompts like:
Give me again a PDF I can obtain the place the yellow background has been eliminated and changed with white.
You probably did it accurately, however sadly, the textual content high quality could be very low decision. Are you able to regenerate it in full decision, please?
Additionally: This easy prompt trick gave me better AI-generated images – no matter the model
These checks labored, however ChatGPT subtly altered the ensuing PDFs. My spouse was involved that ChatGPT would possibly change the notes the phrases or another side of the unique music. She did not need to sight learn and observe it fallacious.
ChatGPT and different AIs are “non-deterministic.” Webster’s defines determinism as, “occurrences in nature, or social or psychological phenomena (that) are causally decided by previous occasions or pure legal guidelines.” In different phrases, the enter at all times predicts the output.
Algorithmic programming, in contrast to AI, is deeply deterministic. Granted, packages can go off the deep finish, however they accomplish that in a means that may in the end be predicted from the precise association of code and variables.
AIs are non-deterministic. Which means you might feed in the very same enter three or 4 instances, and get three or 4 completely different outcomes again. It is type of like speaking to a plumber or an electrician. AIs base their outcomes on a fancy collection of chance calculations, so the outcomes can change with every cross.
Additionally: ChatGPT’s new memory upgrade is powerful – and could poison every answer it gives you
Denise has skilled this in her interactions with ChatGPT. She most undoubtedly did not need to give ChatGPT her music and get again one thing the place ChatGPT took liberties with the masters.
She needed a software to take away background colour that was strictly deterministic.
Python can try this
For my last program in my Harvard Python programming certificationI wrote an interactive picture administration software that was capable of do particular person Photoshop-like picture transformations, and batch them collectively in sequences. So I knew that Python has the libraries to perform what Denise needed.
Additionally: I stopped using ChatGPT for everything: These AI models beat it at research, coding, and more
I, then again, did not have the time to put in writing a Python program to try this. It was a really busy week. I had a protracted backlog of work-related tasks I wanted to energy although.
However ChatGPT has on a regular basis on this planet. That is the place issues get cool. You should use a non-deterministic software like ChatGPT to generate a deterministic program, like a Python decoloring software. If you wish to learn a extremely attention-grabbing article on AI determinism vs. non-determinism, read this by former ZDNETer Jason Perlow.
In any case, I made a decision to ask ChatGPT to put in writing a Python script that will do the colour elimination. To create the script, I gave it this immediate, after which went into the kitchen to assist my spouse put together dinner.
Write a python script that takes in a jpeg and units any pixels that aren’t grey or black to white, saving it again out as name-decolor.jpg the place title is the file title. Enable barely tinted grays in order that black textual content on a coloured background will render correctly as black textual content. Are you able to do the identical factor if a PDF is introduced? It additionally must work if the PDF is a number of pages.
By the point dinner was completed, so was ChatGPT. The primary model of the script had just a few points as a result of I wanted to put in a Python library. However after that, it simply ran.
It really works very merely. You execute this system decolor_pdf.py from the command line, feeding it a single PDF file. It outputs a brand new PDF file with the background colour eliminated.
% python decolor_pdf.py enter.pdf
Does it work?
Yeah, it does. If you wish to obtain a duplicate for your self, it is on my GitHub repo. My spouse was involved about me utilizing screenshots on this article from the copyrighted church hymnals, so visited the New York Public Library’s web site and grabbed a public area music to display.
This can be a music by jazz nice Fat Waller, who additionally wrote a number of musicals. It’s kind of of a racy music, utilizing horse racing metaphors to explain altering lovers. It was co-written with Andy Razaf, recognized for writing the lyrics to songs as “Ain’t Misbehavin'” and “Honeysuckle Rose”.
Useful classes
So there are just a few useful takeaways from this expertise.
- If you’d like the AI’s assist, you do not at all times have to depend on non-deterministic processing. Typically, you’ll be able to simply ask for it to put in writing you a program that works based mostly on a dependable algorithm.
- You additionally do not have to spend so much of time on creating a glance or UI. Typically making a easy command-line software will get the job completed.
- Do not be afraid to refine your spec with the AI. Check out what it creates after which ask for tweaks and fixes.
- Python can do quite a bit. There are various, many libraries so in the event you’re undecided what you need to use, construct it in Python.
So there you go. In case you want a fast resolution to one thing, strive asking ChatGPT to put in writing it for you. Labored for me and I used to be capable of give my spouse a workable software and assist de-chickelate a rotisserie rooster on the identical time.
Additionally: I tested ChatGPT Images 2.0 vs. Gemini Nano Banana to see which is better – this model wins
Have you ever ever averted utilizing AI straight since you have been frightened it’d subtly change the unique file? Tell us within the feedback beneath.
You’ll be able to comply with my day-to-day venture updates on social media. You’ll want to subscribe to my weekly update newsletterand comply with me on Twitter/X at @DavidGewirtzon Fb at Facebook.com/DavidGewirtzon Instagram at Instagram.com/DavidGewirtzon Bluesky at @DavidGewirtz.comand on YouTube at YouTube.com/DavidGewirtzTV.
