Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Jittery text in successive PostScript sequences

1 view
Skip to first unread message

Paul Wessel

unread,
Jan 23, 2018, 1:06:41 AM1/23/18
to bug-gho...@gnu.org
Hi developers-

GMT (gmt.soest.hawaii.edu) is using PostScript to make plots and one application builds an animation from sequences of PostScript plots converted to PNG with ghostscript (9.22) and then to MP4 with ffmpeg.  We have found a problem that may be a ghostscript bug, or alternatively we are doing something wrong.  When using a perspective view (i.e., using a matrix concatenation to simulate perspective), the resulting oblique text strings "jitter" when viewed as a movie.  For an example, see www.soest.hawaii.edu/pwessel/bug_200.mp4.  As the movie plays, you will see the INDIVIDUAL letters in the word HELL jitter relative to each other, despite being set via a single show command (here just a snippet of our code; setting currentpoint, font etc are omitted here)

(HELL) dup dup stringwidth pop -2 div exch sh -2 div rmoveto show

where sh is defined as

/sh {gsave matrix setmatrix 0 0 moveto true charpath flattenpath pathbbox newpath 4 1 roll pop pop pop grestore} bind def

[a complete PS example of a single frame can be found here: www.soest.hawaii.edu/pwessel/bug.ps.

At first we suspected flattenpath but HELL (using Helvetica) has no curved segments (?).  We also tried to override the flattening with 0.2 setflat, but no difference.  We suspect some sort of roundoff but it affects the different letters in the word differently, and that is not under our control.  Could any of the operators above be subject to round-off that affect individual letters?

Perhaps developers know where this may happen and if there is anything we can do on our side to remedy the problem.  As you can see there is no jittering for plotting a circle or lines.  The map frame annotations show the same jittering so it affects all text.

Thanks for any insight!  We can provide more details, all individual PS files, etc upon request. FYI, we have tried both tif and jpg instead of png but no difference. We also made PDFs and used OS X Automator to build PNGs and made a movie using QuickTime Pro; same jittering (not sure if OS X High Sierra uses ghostscript in Preview etc).

Paul Wessel
Lead developer
The Generic Mapping Tools

Paul Wessel

unread,
Jan 23, 2018, 2:25:23 AM1/23/18
to bug-gho...@gnu.org
Sorry, should probably state what our final gs command is.  Here is one (building a tif):

gs -q -dSAFER -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dSCANCONVERTERTYPE=2 -dMaxBitmap=2147483647 -dUseFastColor=true -dTextAlphaBits=4 -sDEVICE=tiff24nc -sCompression=lzw -g800x500 -r200 -sOutputFile='bug_163.tif' -f'./psconvert_22623d.eps'

Bob Eby

unread,
Jan 23, 2018, 10:45:38 AM1/23/18
to Paul Wessel, bug-gho...@gnu.org
Hi Mr. Wessel,

Ghostscript is written by Artifex Software: https://artifex.com/
I believe they run a website here: https://ghostscript.com/ for the
main Ghostscript product along with mailing list(s).

This mailing list is for an old GNU copy of Ghostscript back when they
went from regular GPL to Aferro GPL around version 9.14 or so.

Thanks,
Robert Eby

Bradley C. Kuszmaul

unread,
Jan 23, 2018, 12:02:01 PM1/23/18
to Paul Wessel, bug-gho...@gnu.org
It looks like even the straight lines and circles have jaggies, and your jittering looks like it's just jaggies spread across the time domain.  I don't think you can expect it to look good at such low resolution without taking a lot more care about anti-aliasing. Can you increase the resolution?

Bradley C Kuszmaul - via snartphone

Paul Wessel

unread,
Jan 23, 2018, 3:52:26 PM1/23/18
to Bradley C. Kuszmaul, Paul Wessel, bug-gho...@gnu.org
Seems resolution independent; I've tried up to 4K.  Here is a 2000x1250 MP4 movie, just showing the text HELL. It is especially noticeable for angles 20-30.

Bradley C. Kuszmaul

unread,
Jan 23, 2018, 7:03:04 PM1/23/18
to Paul Wessel, bug-gho...@gnu.org
This video is only 800x500, and the jitter's amplitude appears to be one pixel.

Paul Wessel

unread,
Jan 23, 2018, 7:54:45 PM1/23/18
to Bradley C. Kuszmaul, Paul Wessel, bug-gho...@gnu.org
Quicktime says it is 2000x1250 and that is indeed the frame PNG dimensions - perhaps you are viewing it in a browser which shows it to be smaller.  in my browser it looks much smaller as well.
Anyway, we are trying to quantify if indeed it is -/+1 pixel which makes sense in terms of rounding.  I thought the anti-aliasing settings would add the gray to nearby pixels to simulate the sub-pixeling but that does not seem to happen on the projected tex [it does happen on other text that we have examined].

Paul

Bradley C. Kuszmaul

unread,
Jan 23, 2018, 7:58:57 PM1/23/18
to Paul Wessel, bug-gho...@gnu.org
I downloaded the file and asked vlc what's the resolution.  I can still see the jaggies on the lines.    That's probably all I know about your problem.   Maybe by looking at two adjacent frames in PostScript, one could learn more.


Bradley C Kuszmaul - via snartphone
0 new messages