summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Peveler <matt.peveler@gmail.com>2021-10-28 11:56:31 -1000
committerGitHub <noreply@github.com>2021-10-28 11:56:31 -1000
commit82b2cdc7dfae46c5bfcddc695e0ab93597179b73 (patch)
treea37622b9df94e35e506c49363e3724b7870820b1
parente4b2c71720ceb86d6063613a2903779f6409e24f (diff)
downloadasciidoc-py3-82b2cdc7dfae46c5bfcddc695e0ab93597179b73.tar.gz
Reset gravity before using trim on convert (#202)
-rwxr-xr-xasciidoc/resources/filters/music/music2png.py8
1 files changed, 7 insertions, 1 deletions
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)