I use weasyprint library in python to convert an HTML template to png. Then I am trying to convert the png image to jpg using a python library named PIL(PILLOW).
But the image obtained after conversion using PIL is not what I was expecting. The colors are lost and only some components of the image are visible.
from PIL import Image
img = Image.open(file_path)
rgb_im = img.convert('RGB')
jpg_img_path = os.path.splitext(file_path)[0]
jpg_img_path += '.jpg'
rgb_im.save(jpg_img_path)
When I tried to use an online editor, they have provided me the perfect image from the png. Below is the jpg image obtained from the online converter.