datasets metadata --update crops cover images larger than 560x280 to their top-left corner

Open
#1,250 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@tb91117 is already working on this.

Since Nov 19, 2026.

  • #1251 by @tb91117 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start with _upload_dataset_image_file in src/kaggle/api/kaggle_api_extended.py and the crop behavior described in docs/datasets_metadata.md. Check how the image dimensions can be read for PNG, JPEG, and WebP, then compare the proposed centered 2:1 and 1:1 crops with the existing 560x280 behavior and fallback. Done when larger images get centered crops, unreadable dimensions retain the current crops, and the documented behavior matches.

Written by the indexing model from the issue text.

Description

When I upload a 1600x800 dataset-cover-image.png with kaggle datasets metadata --update, the dataset header shows only the top-left 560x280 pixels of the image, zoomed in. The thumbnail is a 280x280 square at x=140, so it's cut from the same corner.

The cause is that _upload_dataset_image_file always sends the same two crop rectangles, whatever the image size:

https://github.com/Kaggle/kaggle-cli/blob/ad776d4dddb30467523e64d245c795e4c7fbe394/src/kaggle/api/kaggle_api_extended.py#L5561-L5577

The docs mention it too ("While you can upload a larger image than 560px x 280px, the crops as specified above will be applied, and this may not look good"):

https://github.com/Kaggle/kaggle-cli/blob/ad776d4dddb30467523e64d245c795e4c7fbe394/docs/datasets_metadata.md?plain=1#L219

Most cover images are larger than the 560x280 minimum, so most uploads end up with a cropped corner, and the crop has to be fixed by hand in the web UI.

Suggestion: read the image size from the file header (PNG, JPEG and WebP all store it near the start, so no new dependency is needed) and send the largest centered 2:1 and 1:1 rectangles. For a 560x280 image that gives exactly the current crops, and the current crops can stay as the fallback when the size can't be read.

For now I work around it by patching the rectangles before the upload (tools/push_cover.py), and the API accepts full-image crops fine. I have a PR ready if this sounds good.

Dominant language
Python
Stars
7.7k
Forks
1.5k
Avg merge
1d 6h
Merged PRs (30d)
17

Getting set up

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.

More from Kaggle/kaggle-cli

All issues in Kaggle/kaggle-cli

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.