Problem with BmpCvt.exe trying to generate C bitmap file with transparency A565 from .png

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Problem with BmpCvt.exe trying to generate C bitmap file with transparency A565 from .png

    I have successfully used BmpCvt.exe V5.32 driven from the command line by a windows batch file to convert a number of .png to C bitmap files in 565 format using commands like:

    BmpCvt.exe "my.png" -saveas"my.c",1,8 -exit

    However when I try to add transparency, and save the file in A565 format (is it even correct that I need alpha format?) the C file generated has errors, so if I try:

    BmpCvt.exe "my.png" -convertintotranspalette -saveas"my.c",1,27 -exit

    then in the generated C file I get:

    "static GUI_CONST_STORAGE unsignedchar _acmy[] = {
    , 0x00,
    , 0x00,"


    VS2010 (at least) don't like the empty assignment in the array "{," and ",,".

    Additionally, it does not seem to be setting transparency:

    static GUI_CONST_STORAGE GUI_LOGPALETTE _Palmy = {
    160, // Number of entries
    0, // No transparency
    &_Colorsmy[0]
    };

    Perhaps I misunderstand how to get transparency into my C bitmaps...
    When driving BmpCvt.exe from the GUI I am unable to save in A565 format, and if I try any other format the BmpCvt.exe no longer shows "Transparent Yes, Color:000000" and changes to "Transparent -".
    I have some further difficulty in looking for the correct command line options as there seems to be a discrepancy between the User & Reference Guide UM03001 (saveas format 27 is A556) and the BmpCvt.exe Help->Command line options which does not seem to be up to date and lists no alpha formats? I tried to add -transparency0 to my command line to specifically force the transparent colour but this had no effect.
    It is clear to me I don't know what I am doing with this tool (!!!), please can somebody assist?

    Thanks,

    Will

  • I think I understand a little more:
    User & Reference Guide UM03001 table 10.6.1 shows which bitmap formats support transparency and which support palettes, and though A565 supports transparency it does not support palettes. This seems to cause the BmpCvt tool problems, perhaps causing the odd code generation?

    If I alter to save in 8 bits per pixel format, this supports both transparency and palette and now I get:

    static GUI_CONST_STORAGE GUI_LOGPALETTE _Palmy = {
    160, // Number of entries
    1, // Has transparency
    &_Colorsmy[0]

    };
    and the code compiles and the bitmap is displayed with transparency.