img2pdf is an open source Python package to convert images to pdf format. It includes another module Pillow which can also be used to enhance image (Brightness, contrast and other things)
Use this command to install the packages
pip install img2pdf
Below is the implementation:
Image can be converted into pdf bytes using
img2pdf.convert() functions provided by img2pdf module, then the pdf file opened in wb mode and is written with the bytes.
Successfully made pdf file
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.