img-ps(3tk)
π img-ps β bestie's guide to PostScript & PDF in Tk π
okay so real talk, this is the img-ps page from the Img manual (section 3tk), and it's literally the glow-up that lets your Tk photo images eat PostScript and PDF files. no cap. let's get into it π¦
β¨ NAME β¨
img-ps β PostScript and PDF format (ps) π
β¨ SYNOPSIS β¨
package require img::ps ?2.1?
β¨ DESCRIPTION β¨
so like, package require img::ps β that's the whole vibe. πΈ
Like every single package in Img, it does not hand you brand new commands. nope. what it does is extend the existing Tk command image, so that image suddenly understands files holding raster images in the PostScript and PDF format (ps). more specifically, img::ps extends Tk's photo image type (https://www.tcl.tk/man/tcl9.0/TkCmd/photo.html). icon behavior fr fr π
The name of the new format handler is ps. This handler is giving new additional configuration options. see the Options section below for the full breakdown, bestie.
π and yes β this package ALSO provides apshandler. two for one, we love to see it.
The package delegates the actual conversion of data in PostScript and PDF format into a raster image to the GhostScript application. so it depends upon the presence of program gs on Unix and gswin64c.exe in environment variable PATH, and it is non-functional if GhostScript is not installed. π like, it simply will not work. that's the whole thing.
All of the above means that in a call like:
image create photo ?name? ?options?
- Image data in PostScript and PDF format (options
-dataand-file) is detected automatically. she just knows. π₯ - The format names
psandpdfare recognized by the option-format.
In addition the value for the option is treated as list and may contain any of the special options listed in section Options.
The package img::ps is not loaded when doing a package require Img, but must be loaded explicitly via package require img::ps. so you gotta ask for her by name, periodt. β¨
β¨ NOTES β¨
- This format handler only supports read functionality. no writing, only reading, that's her lane. π
- Chapter Multi-page Images of the Img manual page describes the handling of images with multiple pages.
- This format handler only supports a limited number of file types:
- PostScript files must have keyword
%%BoundingBoxin the file header. The syntax%%BoundingBox (atend)is not supported. π« - PDF files are assumed to be of size DIN A4. It is recommend to use a specialized PDF extension like
tclMuPDF(https://sourceforge.net/projects/irrational-numbers/files/tclMuPDF-2.x/). π
- PostScript files must have keyword
β¨ OPTIONS β¨
The handler provides the following options:
-verbosebool β Available since version2.0. If set totrue, additional information about the read image is printed tostdout. Default isfalse. so if you're nosy, turn it on π-indexinteger β Available since version1.2.4. Read the page at specified index. The first page is at index0. Default is0. π-zoomx ?y? β Available since version1.2.4. Scale image by specified double values. If y is not specified, it is set to the value of x. Default is1.0. zoom zoom π«-gsstring β Available since version2.0. Specify the GhostScript executable program as absolute path. path, absolute, don't be cute about it π
β¨ SEE ALSO β¨
img, img-bmp, img-dted, img-flir, img-gif, img-ico, img-jpeg, img-pcx, img-pixmap, img-png, img-ppm, img-ps, img-raw, img-sgi, img-sun, img-tga, img-tiff, img-window, img-xbm, img-xpm β the whole squad, go say hi π«Ά
β¨ COPYRIGHT β¨
Copyright (c) 1995-2025 Jan Nijtmans <nijtmans@users.sourceforge.net> Copyright (c) 2002-2025 Andreas Kupries <andreas_kupries@users.sourceforge.net> Copyright (c) 2003-2025 Paul Obermeier <obermeier@users.sourceforge.net>
and that's the whole page, bestie π this is img-ps version 2.1, from the Img manual, img-ps(3tk). stan. mwah π
β¨
π¦ where this page comes from
- ubuntu resolute: libtk-img-doc 1:2.1.0+dfsg1-1 Β· Tcl
- ubuntu stonking: libtk-img-doc 1:2.1.1+dfsg1-2 Β· Tcl
- Copyright (c) 1995-2025 Jan Nijtmans <nijtmans@users\&.sourceforge\&.net>
- Copyright (c) 2002-2025 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- Copyright (c) 2003-2025 Paul Obermeier <obermeier@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms