Loads an image from a file and adds it as a new image layer.
If Filename is '' then an open dialog is displayed (using ExecuteOpenDialog) to allow the user to browse for an image to load for the layer. idx specifies the insertion index for the layer, or -1 to append.
Returns the index of the new layer, or -1 in case of error.