- (let* ((format-str (format "~a" pixmap-format))
- (extension (cond
- ((string-contains format-str "png") "png")
- ((string-contains format-str "jpg") "jpeg")
- ((string-contains format-str "jpeg") "jpeg")
- (else
- (ly:error "Unknown pixmap format ~a" pixmap-format))))
- (base (basename (re-sub "[.]e?ps" "" ps-name)))
- (png1 (format "~a.~a" base extension))
- (pngn (format "~a-page%d.~a" base extension))
- (page-count (ps-page-count ps-name))
- (multi-page? (> page-count 1))
- (output-file (if multi-page? pngn png1))
-
- (gs-variable-options
- (if multi-page?
- (format #f "-dDEVICEWIDTHPOINTS=~,2f -dDEVICEHEIGHTPOINTS=~,2f"
- page-width page-height)
- "-dEPSCrop"))
- (cmd (format #f "~a\
+ (let* ((format-str (format #f "~a" pixmap-format))
+ (extension (cond
+ ((string-contains format-str "png") "png")
+ ((string-contains format-str "jpg") "jpeg")
+ ((string-contains format-str "jpeg") "jpeg")
+ (else
+ (ly:error "Unknown pixmap format ~a" pixmap-format))))
+ (base (string-join
+ (string-split (dir-basename ps-name ".ps" ".eps") #\%)
+ "%%"))
+ (png1 (format #f "~a.~a" base extension))
+ (pngn (format #f "~a-page%d.~a" base extension))
+ (page-count (ps-page-count ps-name))
+ (multi-page? (> page-count 1))
+ (output-file (if multi-page? pngn png1))
+
+ (gs-variable-options
+ (if (string-suffix-ci? ".eps" ps-name)
+ "-dEPSCrop"
+ (format #f "-dDEVICEWIDTHPOINTS=~,2f -dDEVICEHEIGHTPOINTS=~,2f"
+ page-width page-height)))
+ (cmd (ly:format "~a\