vgalin / html2image

A package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.
MIT License
354 stars 43 forks source link

Problem with sizing #63

Closed aramonpa closed 2 years ago

aramonpa commented 2 years ago

Hello guys,

I'm trying to resize an image, my monitor is 1920x1080p but I want to crop the image.

For example: hti.screenshot(html_file = 'index.html', save_as = 'out.jpg', size = (600, 600))

Where starts to crop the image size parameter? My screenshot is getting cropped badly and only is working if I set my full screen resolution.

Kind regards

aramonpa commented 2 years ago

Hello again,

I read the documentation again, I think that I missunderstood size parameter. Size parameter specifies the size of the image and not crops the image

Could be possible?

Thanks

vgalin commented 2 years ago

Hello, you will have to use an image-processing-dedicated library, such as Pillow, to crop an image, using the crop() method for example.

aramonpa commented 2 years ago

Hello vgalin

Yes, supposed that. I already use crop() method of Pillow.

By the way, thanks for your answer, I though that size param was for cropping images