From 0054f5ee9dcf0c2b0765cca22fc00fc8b9bb6e2e Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Sun, 17 Oct 2021 08:27:13 -1000 Subject: Reset gravity before using trim on convert Signed-off-by: Matthew Peveler --- asciidoc/resources/filters/music/music2png.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/asciidoc/resources/filters/music/music2png.py b/asciidoc/resources/filters/music/music2png.py index c758b4c..a7f0f3c 100755 --- a/asciidoc/resources/filters/music/music2png.py +++ b/asciidoc/resources/filters/music/music2png.py @@ -151,7 +151,13 @@ def music2png(format, infile, outfile, modified): # Chop the bottom 75 pixels off to get rid of the page footer then crop the # music image. The -strip option necessary because FOP does not like the # custom PNG color profile used by Lilypond. - run('convert "%s" -strip -gravity South -chop 0x75 -trim "%s"' % (outfile, outfile)) + # We reset the +gravity before running -trim to avoid a bug in GraphicsMagick. + run( + 'convert "%s" -strip -gravity South -chop 0x75 +gravity -trim "%s"' % ( + outfile, + outfile + ) + ) for f in temps: if os.path.isfile(f): print_verbose('deleting: %s' % f) -- cgit v1.2.1