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

Abierto
#1,250 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@tb91117 ya está trabajando en esto.

Desde el 19/11/2026.

  • #1251 de @tb91117 — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
7.7k
Forks
1.5k
Merge medio
1 d 6 h
PR fusionados (30 d)
17

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Kaggle/kaggle-cli

Todos los issues de Kaggle/kaggle-cli

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.