Discretized UV map of vertex color


I have mesh with vertex color and I would like to get the UV mapping of it as an image,
i.e to get array of HxWxCh [H - Height , W - Width , Ch - RGB channel] in python scripting.

Any idea is welcome

Vertex Color Master have conversion from Vcol to UVs