musescore/MuseScore — pull request #1514 by MarcSabatella (2014-12-07 21:29:03+00:00)
Title: fix #31856: add option to trim whitespace from exported PNG

Added command line option "-T margin" to trim exported PNG with specified number of pixels as margin (0 works; if margin is too big for page in any direction, it stops at that page edge). Along the way, discovered user preference for transparency was being ignored on export (honored only for screenshot mode) and fixed this.

I would love to also have the trim option working for SVG export, but the way it is implemented is totally different from PNG, so there was no easy way I could find to make this work. I'm sure someone with a deeper knowledge of Qt graphics and/or the representation of page elements in MuseScore could pull it off.