[image_en-decoding] Encoder rejects standard BMPs; accept BITMAPINFOHEADER (40-byte DIB)

Aperta
#388 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
75/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start in Encoder_Decoder/image_en-decoding/src/encoder.cpp, especially readBMP() around lines 38–49, and trace how it reads the BMP header and pixel data. Check the existing encoder and decoder workflow, then add tests for 24-bit uncompressed BMPs with 40-byte headers in both bottom-up and top-down layouts. Done means Pillow- and ImageMagick-written BMPs encode successfully, and compressed or paletted BMPs receive a clear rejection message.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: encoder-decoder good first issue priority: P2 size: S type: enhancement

Summary

readBMP() only accepts OS/2 1.x BMPs (pixel-data offset 0x1A, 12-byte BITMAPCOREHEADER) - the format the decoder writes. Practically every BMP produced by Pillow, GIMP, Paint or ImageMagick uses the 40-byte BITMAPINFOHEADER (offset 54) and is rejected, contradicting the README's "IMage encodes uncompressed BMPs".

Location

  • Encoder_Decoder/image_en-decoding/src/encoder.cpp:38-49

Evidence

$ python -c "from PIL import Image; Image.new('RGB',(93,67)).save('grad.bmp')"
$ bin/encoder grad.bmp
Reading grad.bmp...
Error - Invalid offset
$ bin/encoder rt.bmp        # BMP written by bin/decoder
-> rt.jpg, Pillow decodes it; PSNR vs input 44.8 dB

Expected

24-bit uncompressed BMPs with BITMAPINFOHEADER (bottom-up and top-down) are accepted.

Proposed fix

Read the pixel-data offset and DIB size from the header; support DIB sizes 12, 40, 108, 124; handle signed (negative) heights for top-down images; reject compressed/paletted BMPs with a clear message.

Acceptance criteria

  • Pillow- and ImageMagick-written 24-bit BMPs encode successfully
  • Unit test for both bottom-up and top-down BMPs

Repository audit, November 2026 · Phase 9 · New features · evidence: reproduced · ref algorithms-security-048


Generated by Claude Code

Lingua principale
C++
Stelle
2
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ibra-kdbra/Math-Problems

Tutte le issue di ibra-kdbra/Math-Problems

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.