Question Details

No question body available.

Tags

python image python-imaging-library

Answers (1)

April 5, 2026 Score: 0 Rep: 149,586 Quality: Medium Completeness: 80%

Images are much bigger than it has in name.
Probably they can be used to zoom and still have readable image.

Using print(img.size) I get (349, 886) for image with name 013843141.5359.jpg

Web browser uses width:738px; height:148px to display it with this size - so it resizes it automatically.

But in Python you have to resize it on your own before paste()

img = Image.open(BytesIO(requests.get(url).content))

#pritn(img.size)

img = img.resize((int(w), int(h)))

Result: (but text is not so readable when you open in new tab/window)


To make it more readable you may need to calculate in what scale images are and rescale values x,y,w,h to get bigger image.

Using values (349, 886) and 013843141.5359.jpg it seems scale is ~2.648 so it may need this (without img.resize)

    x, y, w, h = map(float, [x, y, w, h])
    x = 2.468  x
    y = 2.468  y
    w = 2.468  w
    h = 2.468  h

And now I get image which is readable.

Result (open in new tab/window to see in full size and see readable text)


Full code:

import requests
from PIL import Image
from io import BytesIO

urls = [ "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/013843141.5359.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/01181.541738148.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/0138.5406137180.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/0136.5579147359.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/01182.5184739283.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/01182.5466592474.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/01774.5465143263.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/01773.5725144215.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/0139.5938440310.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/0138.51242440147.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/01477.5937151458.jpg", "https://epaper.janayugomonline.com/assets/epaper/thiruvananthapuram/2026/04/05/slices/01625.5937294451.jpg", ]

tiles = [] maxw, maxh = 0, 0

for url in urls: print("url:", url)

name = url.split("/")[-1].replace(".jpg", "") , x, y, w, h = name.split("")

x, y, w, h = map(float, [x, y, w, h]) x = 2.468 x y = 2.468 y w = 2.468 w h = 2.468 h

img = Image.open(BytesIO(requests.get(url).content)) print("size:", img.size)

# img = img.resize((int(w), int(h)))

tiles.append((img, round(x), round(y)))

maxw = max(maxw, round(x + w)) maxh = max(maxh, round(y + h))

canvas = Image.new("RGB", (maxw, maxh), (255, 255, 255))

for img, x, y in tiles: canvas.paste(img, (x, y))

canvas.save("output.jpg")