bmp: ignore alpha in Decode when the alpha channel is not supported

When the alpha channel is not supported, the alpha component in the
original image should be ignored in the decoded image data (that is,
set to 0xFF in the decoded data).

testdata/yellow_rose-small.png has been modified to pass the test.
No new test is added because testdata/yellow_rose-small.bmp has
covered this case.

Fixes golang/go#54368.

Change-Id: Ib46947ec0448340e4313773f3c8534f4dc26bc36
GitHub-Last-Rev: 1eeb39647c0873ae47aab1e3934394e5180de59a
GitHub-Pull-Request: golang/image#10
Reviewed-by: Nigel Tao <>
Reviewed-by: Than McIntosh <>
Reviewed-by: Bryan Mills <>
2 files changed
tree: 5cf3d476c344ce564d2f0ab73c40a7757687e0cd
  1. bmp/
  2. ccitt/
  3. cmd/
  4. colornames/
  5. draw/
  6. example/
  7. font/
  8. math/
  9. riff/
  10. testdata/
  11. tiff/
  12. vector/
  13. vp8/
  14. vp8l/
  15. webp/
  16. .gitattributes
  17. .gitignore
  18. codereview.cfg
  20. go.mod
  21. go.sum

Go Images

Go Reference

This repository holds supplementary Go image libraries.


The easiest way to install is to run go get -u You can also manually git clone the repository to $GOPATH/src/

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see

The main issue tracker for the image repository is located at Prefix your issue with “x/image:” in the subject line, so it is easy to find.