Update packtools to 4.16.1 to fix thumbnail creation error#496
Draft
Update packtools to 4.16.1 to fix thumbnail creation error#496
Conversation
…n error Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix optimiser error in packtools when creating thumbnail
Update packtools to 4.16.1 to fix thumbnail creation error
Mar 11, 2026
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O que esse PR faz?
Atualiza packtools de
2.9.5para4.16.1, corrigindo oValueError: image has wrong modeque ocorre ao gerar miniaturas de imagens com modos incompatíveis (P, CMYK, I, F, etc.) durante a otimização de pacotes SPS.Onde a revisão poderia começar?
requirements.txt— única alteração.Como este poderia ser testado manualmente?
Processar um pacote SPS contendo imagens com modo
P(paleta) ouCMYKe verificar que ooptimize_package_task_idcompleta sem erro.Algum cenário de contexto que queira dar?
O PIL não suporta
thumbnail()/resize()com resampler LANCZOS em imagens com certos modos de cor. O packtools 4.16.1 converte a imagem para RGB/RGBA antes do resize, resolvendo o problema na raiz.Screenshots
N/A
Quais são tickets relevantes?
scieloorg/ajuda#15
Referências
Original prompt
This section details on the original issue you should resolve
<issue_title>Erro do optimiser do packtools ao criar miniatura</issue_title>
<issue_description>### Descrição do problema
O packtools foi corrigido. Use a versão 4.16.1.
Passos para reproduzir o problema
Comportamento esperado
...
Screenshots ou vídeos
n/a
Anexos
scieloorg/ajuda#15
Ambiente utilizado
opac-airflow v1.0.0-rc84
Diagnóstico
Análise do Erro
O erro
ValueError: image has wrong modeocorre no PIL/Pillow ao tentar redimensionar uma imagem para gerar o thumbnail. Isso geralmente acontece quando a imagem está em um modo não suportado para resize com certos resamplers — como modoP(paleta/indexed),CMYK,LA, ouI(32-bit integers).O problema está em
packtools/utils.py, linha 421:Causa Raiz
O PIL não consegue fazer
resizecomLANCZOS(ou outros res...✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.