notion-py icon indicating copy to clipboard operation
notion-py copied to clipboard

Not documented: how to set the size of an image

Open konahart opened this issue 2 years ago • 1 comments

By default, ImageBlocks take up the entire width of the page. If you have a small image, this can look terrible.

You can set the dimensions of an image by setting its width, like so:

image_block = row.children.add_new(ImageBlock)
image_block.width = 250

Notion will automatically scale the height to keep the aspect ratio.

Be sure to set the size after uploading an image:

image_block = row.children.add_new(ImageBlock)
image_block.upload_file(f)
image_block.width = 250

Mostly making an issue because I couldn't find the information in this repo. Hopefully this helps someone else.

konahart avatar May 22 '22 02:05 konahart

Thank you!

wherewith avatar Oct 14 '22 20:10 wherewith