Skip to content

Instantly share code, notes, and snippets.

View arleite's full-sized avatar
🖥️
Working

André Leite arleite

🖥️
Working
  • Exo Software
  • Porto
View GitHub Profile
@arleite
arleite / main.py
Last active May 2, 2023 21:58
Replace image PDF
import sys
import os
from PIL import Image
# Include the \n to ensure extact match and avoid partials from 111, 211...
OBJECT_ID = "\n11 0 obj"
def replace_image(filepath, new_image):
f = open(filepath, "rb")