You can use a raster layer for map_layer_id and map_layer_name when the raster layer supports legends. Only the image file formats supported by the Advanced Raster product have the ability to create raster legends. The file formats supported in Advanced Raster can be found on the PRO tab by clicking Options. Under the MapInfo Pro Raster section, click Preferences to see a list of the supported raster formats.
Most of the Create Designer Legend statement applies to raster legends except for the Using clause. When a Frame From Layer clause contains a Using clause, a raster layer returns an error and does not create the legend. The Using clause does not apply to raster legend frames, because it refers to vector table elements like columns and label expressions.