Corrected BMP and TGA palette size when saving by radarhere · Pull Request #6500 · python-pillow/Pillow
#6060 contained a commit entitled "Allow getpalette() to return less than 256 colors"
That meant that when saving BMP and TGA images, the palette might be smaller than 256 colors. However, the plugins always specify the length of the palette as 256 for P images.
This PR changes them to match the length of the palette.