@GetMapping(value = "/{id}", produces = MediaType.IMAGE_PNG_VALUE) This have only 3 types: GIF, PNG, JPEG. For bmp returns just black pixels. How to deal with it?
@GetMapping(value = "/{id}", produces = MediaType.IMAGE_PNG_VALUE) This have only 3 types: GIF, PNG, JPEG. For bmp returns just black pixels. How to deal with it?
You need to specify media type for BMP images.
According to RFC standart, the media type for bmp images is "image/bmp"
RFC standart:
https://www.rfc-editor.org/rfc/rfc7903.html
https://www.iana.org/assignments/media-types/media-types.xhtml#image
MediaType class contain just a few string constants. You can extend it according to RFC. Also you can define any custom media type string in produces tag.
@GetMapping(
value = "/{id}",
produces = "image/bmp"
)
public @ResponseBody
byte[] getImage(@PathVariable("id") String id) throws IOException {
}