{"slug": "i-had-chatgpt-build-me-a-free-pdf-editor-because-i-didn-t-trust-it-to-change-my", "title": "I had ChatGPT build me a free PDF editor because I didn't trust it to change my files - it worked!", "summary": "A user asked ChatGPT to build a free PDF editor that removes yellow backgrounds from scanned sheet music after discovering that ChatGPT's direct PDF edits were non-deterministic and risked altering the musical notes. The resulting command-line Python script reliably stripped the background color without changing the content, allowing the user's wife to reprint the music on standard paper and feed it into a playback app. The approach demonstrates that AI can be more trustworthy when used to write deterministic tools rather than directly editing files.", "body_md": "# I had ChatGPT build me a free PDF editor because I didn't trust it to change my files - it worked!\n\n*Follow ZDNET: *[Add us as a preferred source](https://cc.zdnet.com/v1/otc/00hQi47eqnEWQ6T9d4QLBUc?element=BODY&element_label=Add+us+as+a+preferred+Google+source&module=LINK&object_type=text-link&object_uuid=5e5d2e64-4b30-43e6-8555-26eac7e449f3&position=1&template=article&track_code=__COM_CLICK_ID__&url=https%3A%2F%2Fwww.google.com%2Fpreferences%2Fsource%3Fq%3Dzdnet.com&view_instance_uuid=379e95d2-6b56-476b-a90b-043a8dd63bd3)* on Google.*\n\n### ZDNET's key takeaways\n\n- Yellow sheet music can confuse playback apps.\n- A command-line Python script solved the PDF problem.\n- Sometimes AI is best used to write the tool.\n\nRecently, my wife, Denise, started singing with her church's choir. She has a lovely singing voice. She needed to practice all the new songs. The songs came in booklets, about the size of a trade paperback, printed on yellow paper. She wanted to scan those booklets into her computer as a PDF, remove the color, and reprint them larger, on 8.5-by-11-inch paper so she wouldn't have to wear her reading glasses to see them.\n\nSo one afternoon she came to me. She asked how she could remove the yellow background, but preserve the music itself, so that she could print it out without wasting a huge amount of color printer ink. If she printed it out in black and white, she'd still be using a lot of ink to print out a gray background, which would be even harder to see.\n\n**Also: ****How to use ChatGPT: A beginner's guide to mastering OpenAI's chatbot in 2026**\n\nShe was also planning to feed the music into [PlayScore 2,](https://www.playscore.co/) an app that plays the sheet music so that you can sing along to it. She was concerned the software might not like the background color.\n\nI initially suggested removing the yellow background in Photoshop, but the procedure turned out to be too fiddly. Each image needed slightly different slider settings. It was just too annoying and time consuming to do it that way.\n\nSo, I suggested she use ChatGPT. She has a [ChatGPT Plus](https://www.zdnet.com/article/is-chatgpt-plus-worth-it-free-go-pro-plans-compared/) account, so this seemed like a fair option.\n\n## Deterministic vs. non-deterministic\n\nI did some tests, using prompts like:\n\nGive me back a PDF I can download where the yellow background has been removed and replaced with white.\n\nYou did it correctly, but unfortunately, the text quality is very low resolution. Can you regenerate it in full resolution, please?\n\nThese tests worked, but ChatGPT subtly altered the resulting PDFs. My wife was concerned that ChatGPT might change the notes the words or some other aspect of the original music. She didn't want to sight read and practice it wrong.\n\nChatGPT and other AIs are \"non-deterministic.\" [Webster's defines determinism](https://www.merriam-webster.com/dictionary/determinism) as, \"occurrences in nature, or social or psychological phenomena [that] are causally determined by preceding events or natural laws.\" In other words, the input always predicts the output.\n\n**Also: ****This easy prompt trick gave me better AI-generated images - no matter the model**\n\nAlgorithmic programming, unlike AI, is deeply deterministic. Granted, programs can go off the deep end, but they do so in a way that can ultimately be predicted from the exact arrangement of code and variables.\n\nAIs are non-deterministic. This means that you could feed in the exact same input three or four times, and get three or four different results back. It's kind of like talking to a plumber or an electrician. AIs base their results on a complex series of probability calculations, so the results can change with each pass.\n\nDenise has experienced this in her interactions with ChatGPT. She most definitely didn't want to give ChatGPT her music and get back something where ChatGPT took liberties with the masters.\n\nShe wanted a tool to remove background color that was strictly deterministic.\n\n## Python can do that\n\nFor my final program in my [Harvard Python programming certification](https://www.zdnet.com/article/harvard-free-online-coding-classes/), I wrote an interactive image management tool that was able to do individual Photoshop-like image transformations, and batch them together in sequences. So I knew that Python has the libraries to accomplish what Denise wanted.\n\n**Also: ****I stopped using ChatGPT for everything: These AI models beat it at research, coding, and more**\n\nI, on the other hand, didn't have the time to write a Python program to do that. It was a very busy week. I had a long backlog of work-related projects I needed to power though.\n\nBut ChatGPT has all the time in the world. This is where things get cool. You can use a non-deterministic tool like ChatGPT to generate a deterministic program, like a Python decoloring tool. If you want to read a really interesting article on AI determinism vs. non-determinism, [read this](https://techbroiler.net/all-our-tests-passed-the-agent-was-still-broken/) by former ZDNETer Jason Perlow.\n\nIn any case, I decided to ask ChatGPT to write a Python script that would do the color removal. To create the script, I gave it this prompt, and then went into the kitchen to help my wife prepare dinner.\n\nWrite 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.\n\nBy the time dinner was done, so was ChatGPT. The first version of the script had a few issues because I needed to install a Python library. But after that, it just ran.\n\nIt works very simply. You execute the program decolor_pdf.py from the command line, feeding it a single PDF file. It outputs a new PDF file with the background color removed.\n\n```\n% python decolor_pdf.py input.pdf\n```\n\n## Does it work?\n\nYeah, it does. If you want to download a copy for yourself, it's on [my GitHub repo](https://github.com/davidgewirtz/decolor_pdf). My wife was concerned about me using screenshots in this article from the copyrighted church hymnals, so visited the New York Public Library's website and grabbed a public domain song to demonstrate.\n\nThis is a song by jazz great Fats Waller, who also wrote several musicals. It's a bit of a racy song, using horse racing metaphors to describe changing lovers. It was co-written with Andy Razaf, known for writing the lyrics to songs as \"Ain't Misbehavin'\" and \"Honeysuckle Rose\".\n\n## Helpful lessons\n\nSo there are a few helpful takeaways from this experience.\n\n- If you want the AI's help, you don't always need to rely on non-deterministic processing. Sometimes, you can just ask for it to write you a program that works based on a reliable algorithm.\n- You also don't have to spend a lot of time on creating a look or UI. Sometimes creating a simple command-line tool will get the job done.\n- Don't be afraid to refine your spec with the AI. Try out what it creates and then ask for tweaks and fixes.\n- Python can do a lot. There are many, many libraries so if you're not sure what you want to use, build it in Python.\n\nSo there you go. If you need a quick solution to something, try asking ChatGPT to write it for you. Worked for me and I was able to give my wife a workable tool *and* help de-chickelate a rotisserie chicken at the same time.\n\n**Also: ****I tested ChatGPT Images 2.0 vs. Gemini Nano Banana to see which is better - this model wins**\n\nHave you ever avoided using AI directly because you were worried it might subtly change the original file? Let us know in the comments below.\n\n*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.*\n\n#### Featured\n\n[Editorial standards](/editorial-guidelines/)", "url": "https://wpnews.pro/news/i-had-chatgpt-build-me-a-free-pdf-editor-because-i-didn-t-trust-it-to-change-my", "canonical_source": "https://www.zdnet.com/article/using-chatgpt-to-build-free-pdf-editor-python-tool/", "published_at": "2026-06-05 14:06:00+00:00", "updated_at": "2026-06-05 15:01:13.081013+00:00", "lang": "en", "topics": ["generative-ai", "ai-tools", "artificial-intelligence"], "entities": ["ChatGPT", "ZDNET", "Denise"], "alternates": {"html": "https://wpnews.pro/news/i-had-chatgpt-build-me-a-free-pdf-editor-because-i-didn-t-trust-it-to-change-my", "markdown": "https://wpnews.pro/news/i-had-chatgpt-build-me-a-free-pdf-editor-because-i-didn-t-trust-it-to-change-my.md", "text": "https://wpnews.pro/news/i-had-chatgpt-build-me-a-free-pdf-editor-because-i-didn-t-trust-it-to-change-my.txt", "jsonld": "https://wpnews.pro/news/i-had-chatgpt-build-me-a-free-pdf-editor-because-i-didn-t-trust-it-to-change-my.jsonld"}}