Plugin MU3 - Inserting image

• Dec 28, 2024 - 01:17

Hello everyone.
I want to create a MU 3 plugin allowing me to insert images (png or svg) on ​​a score.
I know I can use palettes, but I want to do it through a plugin.
https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/names… seems to indicate that one can create a newElement(Element.IMAGE). However, even by searching the documentation, I cannot find how to indicate the "linkpath" written in the generated mscz (and mscx) file.
I tried:
var picturenote = newElement(Element.IMAGE);
picturenote.path = "C:/Users/.../Pictures/mypicture.png"
cursor.add(picturenote);
Nothing happens and the debugger shows no errors.
Thanks for your help.


Comments

Might not be possible, unfortunately.
Not sure, but given an "image" element, you'd probably need to perform the following (if it's possible):

1) image.setImageType(ImageType::SVG (or) ImageType::RASTER);
2) image.load("total/filepath/filename");
3) and maybe image.setParent to the ChordRest pointed at by the cursor

all before the cursor.add invocation. Good luck!

Do you still have an unanswered question? Please log in first to post your question.