Skip to Content
0
May 20, 2020 at 08:32 AM

Convert BITMAP bytecount 24 to bytecount 8, grey background instead of white color

651 Views

Hi Gurus! Im trying to upload an image BMP to SE78 with white background color. Firstly I get the image with the methodif_cl_gui_gp_pres=>graphic_proxy~export (the image is a pie diagram painted like in program GFW_PROG_PIE)

CALL METHOD gp_inst->if_graphic_proxy~export
EXPORTING
format = if_graphic_proxy=>co_format_BMP
width = 50
height = 50
IMPORTING
*CONTENT_TYPE = S
content_length = lv_length
content = lt_bin_content
retval = retval.

When I´m trying to upload this image to SE78 with my program, all is ok but the background in the image is grey, I wan´t to upload the image with the white background, as I can see it in my PC if I download it.

To upload the image to SE78, I call the FM SAPSCRIPT_CONVERT_BITMAP_BDS passing my LT_BIN_CONTENT table (whitch has the graphic in line in type W3MIMETABTYPE = RAW 255) but inside this functiion, in the PERFORM FILL_BMFILE_FROM_BMP, I can see that my file has a bitcount 24 instead of 8 (To see the background white I need to get 256 color bitmap, not 16 million colors bitmap):

"Code inside the FILL_BMFILE _FROM_BMP

case bmp_bitcount.
when 1.
otf_bminfo-bmtype = c_itf_hex_bcol. "2 color
otf_bminfo-is_monochrome = c_false.
when 4.
otf_bminfo-bmtype = c_itf_hex_bcol. "16 color
otf_bminfo-is_monochrome = c_false.
when 8.
otf_bminfo-bmtype = c_itf_hex_bcol. "256 color
otf_bminfo-is_monochrome = c_false.
when 24.
otf_bminfo-bmtype = c_itf_hex_bcol. "16 million colors
otf_bminfo-is_monochrome = c_false.
when others. "16 or 32 bit true color
message e875 with bmp_bitcount raising bmperr_no_colortable.
endcase.

Is there any function, method or something to convert my bin tab to 256 colors? I need to do It inside SAP, not with Paint program.

Thank you .