[PYTHON IMAGE-SIG] postscript printing

Fredrik Lundh fredrik_lundh@ivab.se
Thu, 18 Jul 1996 14:54:06 +0200

> I also tried to use the PSDraw class to create a file, and have
> managed to make the image appear in the file, but the
> PSDraw.rectangle(), and PSDraw.line() functions do not seem to be
> working properly.

Have you applied the patches I posted earlier (and have attached to
this mail)?  Without them, the PostScript coordinate system gets
seriously messed up as soon as you print an image.

I'll take a look at the PSDraw module, and see if there are more
problems lurking around.  Stay tuned.



In Lib/PSDraw.py:

	dx = (xmax - x) / 2 + box[0]
	dy = (ymax - y) / 2 + box[1]
+	self.fp.write("matrix currentmatrix\n")
	self.fp.write("%f %f translate\n" % (dx, dy))
	if (x, y) != im.size:
	    # EpsImagePlugin._save prints the image at (0,0,xsize,ysize)
	    sx = x / im.size[0]
	    sy = y / im.size[1]
	    self.fp.write("%f %f scale\n" % (sx, sy))
	EpsImagePlugin._save(im, self.fp, None, 0)
!	self.fp.write("\nsetmatrix\n")

In libImaging/EpsEncode.c:

	    if (++state->y >= state->ysize) {
		state->errcode = IMAGING_CODEC_END;
!		return ptr - buf;
	    in = (UINT8*) im->image[state->y];

IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org