this doesn't use anything related to code at all, but i found a way to solve the problem that doesn't involve any code and has no side effects. open the image you want to use in preview, and add a narrow bar to the top. make the fill the color you want the menu bar to be. it doesn't have to cover the whole space that the menu bar will take up. i've tried a few different sizes and it seems like as long as it's about a centimeter with a large image the covers the whole preview window. so you can even make your menu bar lime green or dark purple if you wanted to.