larksuite / larksuite/cli

docs +media-download whiteboard thumbnail: content not centered / viewport mismatch

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

Nobody has claimed this yet.

domain/whiteboard
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

Description

When using lark-cli docs +media-download --type whiteboard to export a whiteboard thumbnail, the exported image does not properly center the whiteboard content. The thumbnail appears to capture a fixed viewport from the canvas origin (0,0), which results in content being cut off or offset to one side.

Steps to Reproduce

  1. Create a whiteboard in a Feishu document
  2. Add some content (shapes, text, etc.) to the whiteboard (not near the canvas origin)
  3. Run: lark-cli docs +media-download --type whiteboard --token <whiteboard_token> --output ./thumbnail.jpg
  4. Open the exported thumbnail — content is not centered

Expected Behavior

The exported thumbnail should auto-fit the content bounds (similar to what the Feishu client shows), centering all whiteboard elements in the image. This is the behavior users see when they use "Download as image" in the Feishu client UI.

Actual Behavior

The thumbnail captures a fixed viewport, likely starting from the canvas origin (0,0). Content placed elsewhere on the infinite canvas is offset or partially visible.

Screenshots

Exported via API (whiteboard-v5, content offset to the right):
whiteboard-v5

Another export attempt (whiteboard-v3, same offset issue):
whiteboard-v3

For reference, the Feishu client auto-centers all content in the viewport, but the API thumbnail does not replicate this behavior.

Environment

  • OS: Ubuntu Linux

Suggestion

The whiteboard thumbnail API should either:

  1. Auto-fit content bounds — Calculate the bounding box of all nodes and generate a content-centered thumbnail (most user-friendly)
  2. Accept viewport parameters — e.g. --viewport x,y,width,height so callers can control the captured region
  3. Expose a "get whiteboard nodes" API — Let callers read node positions and compute the bounding box themselves, then combine with option 2

Option 1 would be ideal for most use cases. Option 3 would enable advanced scenarios like programmatic whiteboard-to-image conversion.

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 implementation files or tests are named. Start by tracing the lark-cli docs +media-download --type whiteboard entry point and reproduce the export with content away from the canvas origin. Done means the thumbnail centers all whiteboard content like the Feishu client, but the issue leaves the implementation approach unresolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.