## Plan A 1. list images with command: `pdfimages -j -png file.pdf img` 2. run **list-code-images.py** to find the dark theme code images 3. invert these image to make them light theme code: ```bash for f in `cat file.code-images.txt`; do convert $f -channel RGB -negate inversed/$f done ``` 4. find a way to replace images in a pdf with code (but I gave up here) ## Plan B I end up using PyMuPDF to invert dark theme code images and save them in the same position using **replace-images.py**. You will need to install these packages: ```bash pip install fitz PyMuPDF ``` ------------ ![image](https://user-images.githubusercontent.com/42011920/160681311-be009615-1e24-4a95-b847-78353bf53927.png) Alhamdulillah, all images replaced. This is an illusion of replacement, because the new images are placed in top of the old images. I think there exists some possible ways to really replace using [Document.update_object](https://pymupdf.readthedocs.io/en/latest/document.html#Document.update_object) or [Document.update_stream](https://pymupdf.readthedocs.io/en/latest/document.html#Document.update_stream) provided by PyMuPDF package.