Converting an image to a PDF in the purest sense of the word is not possible in the most cases. This is because most images are raster bitmaps, i.e. a square with color value set for each pixel, while PDFs are a container format.

What usually happens when you “convert” an image to a PDF not a conversion from one file-format to the other, but rather your image is embeded inside a PDF container document. Conceptually it’s not too different from pasting an image into a Word document.

Acomplishing this with Python only takes a couple lines of code using wither `Wand` or `Pillow` (PIL).

“`
# Code snippet Wand
“`
## Walk through

“`
# Code snippet PIL
“`

## Walk through

### Gotchas

### Improved Versions

### Conclusion

Leave a Reply

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