Werner LEMBERG wrote:
Nice idea. While you are at it, please investigate why there are
still clipping problems during the EPS->PNG conversion. [...]
As a possible solution, I can imagine that we add an intermediate step
to convert the fonts in an EPS file into PS paths, for example, by
using the `epswrite' device (as demonstrated in the `eps2eps' script
which comes with ghostscript). This should assure that the bboxes are
exact.
Hi,
some time ago I tried to handle this problem with a little script.
(Makefile attached.) However, I only dealt with PDF->PDF fixing.
In short: I couldn't quite manage to get good results with a
GhostScript-only version, other than tweaking the BoundingBox entries in
an intermediate EPS file for myself, using the GS -sDEVICE=bbox output.
Everything I tried with nothing but GS scripts either did not give the
bboxes as exact as I wanted them, or actually rasterized the file.
Thus I decided to use pdftops from the libpoppler utilities. Which may
be a problem for Windows, but perhaps it's not needed for EPS->x conversion.
Perhaps it will be useful as a template or give some ideas, but it
certainly is not thoroughly tested. I have no idea what happens for
multipage input files, by the way, but this problem won't come up for
EPS->EPS conversion, I guess.
HTH,
Alexander
BASENAME=frieden
RESOLUTION=600
GS=gs -q -dNOPAUSE -dBATCH
.PHONY: all clean
all: $(BASENAME).pdf \
$(BASENAME)-trimmed.pdf \
$(BASENAME)-trimmed.png \
$(BASENAME)-trimmed-no-bg.png
%-trimmed.pdf: %.pdf
# $(GS) -sDEVICE=pswrite -sOutputFile=$*-fixed.ps $<;
# $(GS) -sDEVICE=epswrite -sOutputFile=$*-fixed.eps $*-fixed.ps;
# head -n 1 $*-fixed.eps > $*-trimmed.eps;
# echo `$(GS) -sDEVICE=bbox $*-fixed.eps 2>&1` > $*.bbox;
# sed -e 's/ %%HiResBoundingBox/\n%%HiResBoundingBox/' < $*.bbox >>
$*-trimmed.eps;
# tail -n +4 $*-fixed.eps >> $*-trimmed.eps;
# epstopdf --hires $*-trimmed.eps;
# rm $*-fixed.ps $*-fixed.eps $*.bbox;
cp -f $< $@;
pdftops $@;
rm -f $*-trimmed.eps;
ps2eps -l $*-trimmed.ps;
epstopdf $*-trimmed.eps;
rm -f $*-trimmed.ps;
%.pdf: %.ly
lilypond $<;
#%-trimmed.png: %.png
# convert -trim $< +repage $@;
%-trimmed.png: %-trimmed.pdf
convert -density $(RESOLUTION)x$(RESOLUTION) -units PixelsPerInch
-colorspace Gray -depth 8 $< $@;
%-trimmed-no-bg.png: %-trimmed.png
convert -channel R $< -channel A -size 1x256 gradient:black-none -clut
$@;
%.png: %.ly
lilypond -dresolution=$(RESOLUTION) --png $<;
clean: $(BASENAME).clean
%.clean:
rm -f $*-fixed.ps $*-fixed.eps $*.bbox;
rm -f $*.ps $*.pdf $*.png $*-trimmed.eps $*-trimmed.pdf $*-trimmed.png
$*-trimmed-no-bg.png $*.midi;
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel