Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3548

BMP image with black background color after conversion

$
0
0

I have a problem where I get an image in PNG format CHAR of a legacy system. Convert this char to xstring  then convert the image to BMP. But the BMP image is getting black background.  It seems that this is why the image of the background color is transparent and BMP images do not accept transparent background. Can help me solve this problem?


Thankyou!


CALL FUNCTION 'SCMS_BASE64_DECODE_STR'

   EXPORTING

     input          = w_charfinal

*   UNESCAPE       = 'X'

  IMPORTING

    output         = w_xstring


**Convert PNG to BMP

CREATE OBJECT l_igs_imgconv

   EXPORTING

     destination = 'IGS_RFC_DEST'.

 

li_input_length = XSTRLEN( w_xstring ).

CALL FUNCTION 'RSFO_XSTRING_TO_MIME'

   EXPORTING

     c_xstring = w_xstring

     i_length  = li_input_length

   TABLES

     c_t_mime  = ti_blob_in.

 

l_blog_size = li_input_length.

CALL METHOD l_igs_imgconv->set_image

   EXPORTING

     blob      = ti_blob_in

     blob_size = l_blog_size.

 

l_igs_imgconv->input  = 'image/png'.

l_igs_imgconv->output = 'image/x-ms-bmp'.

l_igs_imgconv->width  = 640.

l_igs_imgconv->height = 480.

 

CALL METHOD l_igs_imgconv->execute

   EXCEPTIONS

     OTHERS = 1.

 

IF sy-subrc IS INITIAL.

 

   CALL METHOD l_igs_imgconv->get_image

     IMPORTING

       blob      = l_img_blob

       blob_size = l_img_size

       blob_type = l_img_type.

 

   DATA: lt_table TYPE TABLE OF lxe_xtab,

         wa_table TYPE lxe_xtab.

   LOOP AT l_img_blob INTO wa_img_blob.

     wa_table-line  = sy-tabix.

     wa_table-bytes = 255.

     wa_table-text  = wa_img_blob-line.

     APPEND wa_table TO lt_table.

     CLEAR wa_table.

   ENDLOOP.

 

   CALL FUNCTION 'LXE_COMMON_TABLE_TO_XSTRING'

     IMPORTING

       ex_xstring = w_xstring

     TABLES

       in_tab     = lt_table.

 

*          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

*            EXPORTING

*              buffer        = lx_assinatura

*            IMPORTING

*              output_length = li_input_length

*            TABLES

*              binary_tab    = ti_bin_content_out.

 

 

ELSE.

 

   CALL METHOD l_igs_imgconv->get_error

     IMPORTING

       number  = l_err_code

       MESSAGE = l_err_text.

ENDIF.


Viewing all articles
Browse latest Browse all 3548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>