'Pad image that is stored as <class> = bytes

I have an image of size (200 by 200). The image data is stored as <class 'bytes'> as below. Is there a way to pad the image to size (1,080 by 1,920)? This is not resize but pad the image to another size.

image_data = '\xc0q\xc7\x1c\x07\x1cq\xc0q\xc7\x1c\x07\x1cq\xc0\xff\xd9......'


Solution 1:[1]

Have you tried looking for the answer already?

There are a lot of answers given to this question already, like this one: (Add padding to images to get them into the same shape)

(https://www.geeksforgeeks.org/add-padding-to-the-image-with-python-pillow/)

It would also help to see what you've already tried and what failed exactly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1