jamalex / jamalex/notion-py

Not documented: how to set the size of an image

Open
#372 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
470
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No documentation file or test is named in the issue. Locate the existing ImageBlock documentation, use the supplied width and upload-order examples as the source, and verify that the resulting guidance explains how to set image dimensions while preserving the aspect ratio.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.