user605364
user605364

Reputation: 21

increase paper size of postscript for animation

I'm trying to create an animation out of multiple postscript figures but the resulting animation is very small. When I check the properties of the figures I see that the paper size is small. If I manually increase the size (e.g. using GIMP) the animation looks good. The problem is that I have many files and I would like to do this automatically. Alternatively fix when rendering the animation.

The animation is done either using imageio in python (1) or convert directly in the terminal (2). Both give similar results.

(1)

import imageio
images = []
for frame in frames:                                                
    f = 'Animate/morph'+str(frame)+'.ps'
    images.append(imageio.imread(f))

imageio.mimsave('animation.gif', images,  duration = 0.5)

(2, e.g.)

convert Animate/morph264.ps -gravity center -resize 792x612\! test.ps

I have also tried the following ghostscript that rescales the size of the ps but the actual image is still small (located in the lower left corner)

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dSAFER -dCompatibilityLevel="1.5" -dPDFSETTINGS="/printer" -dColorConversionStrategy=/LeaveColorUnchanged -dSubsetFonts=true -dEmbedAllFonts=true -dDEVICEWIDTHPOINTS=500 -dDEVICEHEIGHTPOINTS=500 -dAutoRotatePages='/PageByPage' -dFIXEDMEDIA -dPDFFitPage -sOutputFile='test.ps' -f 'Animate/morph264.ps'

Is there some way of doing this without going mad...?

Upvotes: 0

Views: 84

Answers (2)

user605364
user605364

Reputation: 21

for future reference convert were able to do it. Key was to specify the density before the input files. In the terminal write, e.g:

convert -density <high value> <infile(s)> -scale '300%' <outfile.ps/png/etc>

where I used 600 as high value and scaled the size 300%. This gave outfiles in the form outfile-#.ps/png/etc, that I then converted to an animation:

convert -delay 20 -loop 0 <outfile-*> animation.gif

Upvotes: 1

KenS
KenS

Reputation: 31199

Without seeing your PostScript program I cannot tell for certain, but my guess is that it is not requesting a media size at all, or possibly is an EPS with the size indicated by the EPS comments.

You don't need most of your Ghostscript command line, and personally I'd drop the PDFSETTINGS=/printer right off, that will do lots of stuff and you probably don't want it all. Of course this produces a PDF file, not PostScript.

To alter the size (in pixels) of a rendered PostScript program you can increase the resolution, or alter the scale using the PostScript scale operator. I can't give you any real help though, because its not obvious to me exactly how you are using the PostScript program(s). If you are using Ghostscript to render them then I'd need to see the command line you are using for that and an actual example PostScript program.

Upvotes: 0

Related Questions