EPSTOOL(1)
π EPSTOOL(1) β General Commands Manual π
okay bestie, sit down, hydrate, and let me tell you about epstool, the icon of section 1 of the General Commands Manual. she does preview images and bounding box glow-ups for EPS files and honestly? she ate. π
β¨ NAME β¨
epstool β Edit preview images and fix bounding boxes in EPS files.
πΈ SYNOPSIS πΈ
epstool command [ options ] inputfile outputfile
π¦ DESCRIPTION π¦
epstool is a utility to create or extract preview images in EPS files. It can also calculate optimal bounding boxes. like, it's giving "I do it all and I do it well" energy π
π EPS (Encapsulated PostScript Format) π
EPS is a specialised form of a PostScript file that complies with the Document Structuring Conventions (DSC) and is intended to be embedded inside another PostScript file. so it's the little sister format that's meant to live inside a bigger file, got it? π«Ά
An EPS file must contain a special first line that identifies it as an EPS file (e.g. %!PS-Adobe-3.0 EPSF-3.0) and it must contain a %%BoundingBox: line. no cap, those two are non-negotiable. π
The EPS file only draws within the rectangle defined by the bounding box. The PostScript code must avoid using PostScript operators that would interfere with the embedding. These include operators with global effects such as changing the page size and changing the half tone screen. so like, no touching the global settings, bestie, that's rude to your host file π
π PREVIEWS π
EPS files may contain a preview to be used by programs that can't interpret the PostScript code. (yes, some programs just can't read the vibe β¨) There are three ways to add a preview to an EPS file.
- Interchange β This preview is included within PostScript comments in a section marked
%%BeginPreview:/%%EndPreview. The actual image data is stored in hexadecimal format. This format is most commonly used on Unix. - DOS EPS β The preview is a TIFF or Windows Metafile. A DOS EPS file has a 30 byte binary header which gives offsets and lengths for the PostScript, TIFF and Windows Metafile sections. You can't send a DOS EPS file directly to a printer β you have to remove the binary header and preview first. This format is most commonly used on MS-Windows.
- PICT β The preview is in PICT format stored in the resource fork of the file. This format is most commonly used on the Macintosh. Epstool provides limited support for this format.
π COMMANDS (one only): π
okay so the whole point: pick ONE command. one. singular. not two, not three. π
-t4,--add-tiff4-previewβ Add a TIFF 4 preview. The preview is monochrome and is intended for use with old programs that won't read TIFF6, such as Word Perfect 5.1 for DOS. (grandma tech, we respect her π«‘)-t6u,--add-tiff6u-previewβ Add a TIFF 6 uncompressed preview. See--add-tiff6p-previewfor how to add a greyscale or monochrome preview.-t6p,--add-tiff6p-previewβ Add a TIFF 6 preview compressed with packbits (simple run length encoding). The preview will normally be full colour, but you can make it greyscale by adding the option--device bmpgrayor--device pgmraw, or monochrome using--device bmpmonoor--device pbmraw.-tg,--add-tiff-previewβ Add a TIFF preview using ghostscript to generate the TIFF file. You must specify a suitable TIFF device using--device. If you want a compressed monochrome image, you might use--device tiffg3.-i,--add-interchange-previewβ Add a monochrome interchange preview.-w,--add-metafile-previewβ Add a Windows Metafile (WMF) preview. The metafile will contain a bitmap, not vector information. The preview will normally be full colour. See--add-tiff6p-previewfor how to add a greyscale or monochrome preview.--add-pict-previewβ Add a Mac PICT preview. EPSF files with PICT previews can generally be used only on Mac computers. The preview will be full colour. The AppleSingle and MacBinary formats will contain the EPSF and the preview. The AppleDouble or Resource format will contain the preview only and needs to accompany the original EPSF file. To specify the file format use--mac-single,--mac-double,--mac-binaryor--mac-rsrc.--add-user-previewfilename β Add a user supplied image as a preview. The image can be a Windows bitmap, a PBMPLUS file, a TIFF image or a Windows Metafile. Window bitmaps and PBMPLUS files will be converted to TIFF6 compressed with packbits. TIFF and Windows Metafile images will be added unchanged.--bitmapβ Create a bitmap of the area within the EPS bounding box. The bitmap type must be specified with--device. If processing a DCS 2.0 file, the separation can be specified with--page-number.--copyβ Copy the EPS file. This is generally used with the--bboxoption to update the bounding box.--dcs2-multiβ Convert DCS 2.0 separations to multiple files. See DCS 2.0. If the output name isout.eps, then the separations would be namedout.eps.Cyanetc. β¨--dcs2-singleβ Convert DCS 2.0 separations to a single file. See DCS 2.0.--dcs2-reportβ Write the separation names, lengths and CMYK values to standard output. This can be used to identify if a DCS 2.0 file is missing the composite page or preview.--dumpβ Display some information about the file type and DSC comments.-p,--extract-postscriptβ Extract the PostScript section from a DOS EPS file.-v,--extract-previewβ Extract the preview section from a DOS EPS file.-h,--helpβ Display a summary of theepstoolcommands and options.--test-epsβ Partially test if a file complies with the EPSF specification. (partially! she's honest about her limits π )
β¨ OPTIONS β¨
okay bestie, here's the whole menu of flags. every single one. hydrate before you read, it's a lot π
-b,--bboxβ works out the bounding box using the ghostscript bbox device, then updates it inside the EPS file. no cap, that's the whole job β¨--combine-separationsfilename β merges the separations of your input DCS 2.0 file with the separations of this file. it's an error if the bounding boxes don't match, or if they've got separations sharing the same name π you have to pair this with--dcs2-multior--dcs2-single. heads up: the composite page might still need a lil glow-up afterwards with--replace-compositeπ«Ά--combine-tolerancepts β when you're using--combine-separations, this lets the bounding boxes wobble by up to pts points. the default is0, so by default they have to match exactly β no wiggle room, periodt.--custom-coloursfilename β when you run--replace-compositeon a DCS 2.0 file, use the colours written in this file instead of the ones in the composite page. your colours, your rules π-d,--debugβ spill the tea about progress (more verbose), and don't delete the temporary files. she's messy on purpose.--devicename β pick a ghostscript device for making the preview or bitmap:- for
--add-tiff-previewit must be one of the ghostscript tiff devices, liketiffg3ortiff24nc - for any other preview it must be one of the bmp or pbmplus devices, like
bmpgray,bmp16m,pgmraworppmraw - for bitmap output (
--bitmap) it can be any ghostscript bitmap device π
- for
--doseps-reverseβ when writing a DOS EPS file (that's the TIFF or WMF preview situation), the default is to write the PostScript before the preview. this flag flips it so the preview comes before the PostScript section. some buggy programs literally demand it π either order is correct, so don't stress.--dpiresolution β sets the resolution of the preview or the bitmap. default is72dpi. classic.--dpi-renderresolution β renders at a higher resolution set by--dpi-render, then downsamples down to whatever--dpisays. this works when you're adding a preview image or using--replace-composite, but not when using--bitmapπ« it upgrades your preview quality when the original contains a pre-rendered image and--dpi-renderis set to match the original target printer. glow up achieved β¨--ignore-informationβ ignore information messages from the DSC parser. use at your own risk. these messages usually mean something's wrong with the EPS file, but most EPS handlers probably won't care. example: a line with more than 255 characters. π--ignore-warningsβ ignore warnings from the DSC parser. use at your own risk. these are usually about faults in the DSC comments that epstool can recover from, but they might confuse other EPS handlers. example: a bounding box that incorrectly uses floating point numbers instead of integer. not the vibe but okay.--ignore-errorsβ ignore warnings from the DSC parser. use at your own risk. bestie. you really should fix the EPS file first π fr fr.--gscommand β name the ghostscript program. on Unix the default isgs. on Windows, epstool checks the registry for installed versions of ghostscript and uses the latest one, otherwise it falls back togswin32c.exe.--gs-argsarguments β extra Ghostscript arguments. you might use this to select anti-aliasing with"-dTextAlphaBits=4 -dGraphicsAlphaBits=4"π¦--outputfilename β pick the output file instead of using the second file parameter. and if the filename is-, epstool writes to standard output β which requires--quiet. yes, both, or it won't slay.--mac-binaryβ when adding a PICT preview, use the MacBinary I format. for the Mac π--mac-doubleβ when adding a PICT preview, use the AppleDouble format for the Mac.--mac-rsrcβ when adding a PICT preview, use the Resource format for the Mac.--mac-singleβ when adding a PICT preview, use the AppleSingle format for the Mac.--missing-separationsβ when writing a DCS 2.0 file, epstool will normally fail if a separation is missing. with this flag, it removes references to the missing separations while writing the file instead. problem solved π--page-numberpage β when you're creating a bitmap with--devicefrom a DCS 2.0 file, page says which separation to use. page1is the composite, page2is the first separation. use--dcs2-reportto get the full list of separations. iykyk.--quietβ try to run without writing to standard output. she's shy.--rename-separationoldname newname β when copying a DCS 2.0 file with--dcs2-multior--dcs2-single, rename the separation called oldname to newname. this option implies--missing-separations. it's assumed the new name is just an alias for the same colour and that the CMYK or RGB values for the separation don't change. you can use this one multiple times. and you must use it if the input file incorrectly has two separations with the same name. messy input, clean output β¨--replace-compositeβ some DCS 2.0 files just don't have an image in the composite page (iconic of them). this replaces the composite page with a CMYK image derived from the separations. must be used with--dcs2-multior--dcs2-single. see also--dpiand--custom-coloursπ«Ά
π MACINTOSH π
okay so the Macintosh does not do a flat file system. every file can have a data fork and a resource fork, and that's the whole plot twist π
EPSF files keep their PostScript in the data fork, and optionally keep a preview in the resource fork as a PICT image. also, the file type comes from the finder info, not from a file extension. file types use a four character code, like "EPSF" or "PICT". when Macintosh files get copied to a foreign file system, the resource fork might just get left behind π the ways to keep the resource fork are:
- package the finder data, data fork and resource fork all into a single MacBinary or AppleSingle file, or
- put the data fork in a flat file and the finder info plus resource fork into an AppleDouble file.
the Mac OSX finder handles AppleDouble files automatically when copying files to and from a foreign file system. so if you copy test.eps to a foreign file system, the data fork gets written as test.eps and the finder info and resource fork go into the AppleDouble file ._test.eps or .AppleDouble/test.eps β¨
Epstool can read MacBinary and AppleSingle files. it can write MacBinary I, AppleSingle, AppleDouble or Resource files. files written by epstool will have type EPSF and creator MSWD. when adding a preview to test.eps, it's suggested that you create the MacBinary file test.eps.bin. on a Macintosh computer you then need to extract it with StuffIt Expander. another alternative is to write the AppleDouble file to ._test.eps, then copy both files to a file system accessible to a Mac computer π«Ά
here's how epstool guesses the format:
- if the output file name starts with
.β AppleDouble is assumed - otherwise if it ends with
.asβ AppleSingle is assumed - otherwise if it ends with
.rsrcor/rsrcβ Resource is assumed - otherwise β MacBinary is assumed
when writing a MacBinary file, it's recommended that you end the filename in .bin. to force the file type, use --mac-single, --mac-double, --mac-binary or --mac-rsrc. no guessing needed π
on Mac OS X you can access a file's resource fork from command line tools by appending /rsrc to the original file name. the easiest way to add a preview to the file test.eps on Mac OS X is to let epstool write in --mac-rsrc format to test.eps/rsrc (peep the Examples section) π
π DESKTOP COLOR SEPARATIONS (DCS 2.0) π
The Desktop Color Separation (DCS) image file format contains a low resolution preview, a main file with the full resolution composite image, and colour separations with full resolution separated plates. the separations will typically contain Cyan, Magenta, Yellow, Black and possibly spot colours. there are two versions of DCS 2.0, and they are not the same girl π
Multiple File
the main file contains %%PlateFile: (name) EPS Local filename comments which give the filenames of the separation plates. the main file may contain a low resolution DOS EPS preview. the separation files do not contain previews.
Single File
this is an abuse of the EPS specification π the single file contains the main file and the separations concatenated together, which makes the DSC comments incorrect. the main file specifies the byte offsets to the separations using %%PlateFile: (name) EPS #offset size. the single file may then be placed inside a DOS EPS file with a low resolution preview. by default, epstool writes single file DCS 2.0.
Epstool can add previews to single and multiple file DCS 2.0. it can split single file DCS 2.0 into multiple files and vice versa. this means you can split a single file DCS 2.0, replace the composite image, create a new preview, and then recombine it back into a single file. a whole makeover arc β¨
some DCS 2.0 files do not have an image in the composite page. to figure out whether the composite page has no image, use --dcs2-report and look to see if the composite section is very short. using --dcs2-single --replace-composite replaces the composite page with the headers of the original composite page and a body containing a CMYK image derived from the separations. set the resolution of that CMYK image using --dpi π
when replacing the composite page with a CMYK image using --replace-composite, the --custom-colours option is super useful for dealing with DCS 2.0 files that have incorrect CMYK colours β for example, specifying that the varnish layer is grey. each line of the CMYK colours file is formatted like a DSC %%CMYKCustomColor: or %%RGBCustomColor: line, as shown in the example below:
%%CMYKCustomColor: 0.00 0.00 0.00 0.00 Varnish
%%CMYKCustomColor: 1.00 0.68 0.00 0.12 (Dark Blue)
%%RGBCustomColor: 0.5 0.0 0.0 (Dark Red)
DCS2 files should not have two separations with the same name. epstool will not allow a DCS2 output file to have duplicate separation names. use --rename-separation to resolve this π
β¨ EXAMPLES β¨
Okay bestie, this is the part where it all clicks, fr. Real commands, real files, copy-paste energy. Let's go π
π― Add colour preview (24bit/pixel) to EPS file
epstool -t6p tiger.eps output.eps
π Add TIFF (G3 Fax) preview to tiger.eps
epstool --add-tiff-preview --device tiffg3 tiger.eps output.eps
Any GS TIFF device can be used, e.g. tiffg4, tiffpack π
π«³ Extract TIFF preview from tiger.eps
epstool -v tiger.eps tiger.tif
π Fix incorrect %%BoundingBox then add TIFF4 preview
epstool --bbox -t4 golfer.eps output.eps
π§ Adjust the BoundingBox of an existing EPS file, but don't add a preview
epstool --copy --bbox input.eps output.eps
πͺ Add user supplied Windows Metafile to EPS file
epstool --add-user-preview logo.wmf logo.eps output.eps
Typically used when an application can export EPS and WMF separately but can't export EPS with WMF preview. Not me being the middle-man for your files π
π Add a PICT preview and write an AppleDouble file
epstool --add-pict-preview --mac-double tiger.eps ._tiger.eps
To be used by a Mac, both tiger.eps and ._tiger.eps need to be on a foreign file system accessible to the Mac. Two files, one destiny, no cap π¦
πΎ Add a PICT preview, overwriting the existing resources
epstool --add-pict-preview --mac-rsrc tiger.eps tiger.eps/rsrc
On Mac OS X you can access a file's resource fork from command line tools by appending "/rsrc" to the file's original name. Iconic behaviour honestly π
π NOTES π
Okay so important stuff, listen up bestie π«Ά
When adding a WMF preview to an EPS file using -add-user-preview filename, the placeable metafile header is removed from the metafile as it is put into the EPS file. When extracting a WMF preview from an EPS file, a placeable metafile header is created from the EPS BoundingBox information. This placeable metafile header assumes that the WMF has its origin at (0,0), which might not be correct. β οΈ
That last bit is the drama: it assumes(0,0). If your WMF doesn't actually live at(0,0), things may look off. That's just how it is, iykyk π
When epstool is creating a TIFF or WMF preview, it will convert palette colour images into 24-bit/pixel. Glow up, literally β¨
The environment variable TEMP should point to a writeable directory for temporary files. If not defined, /tmp will be used for Unix and the current directory will be used for other platforms. ποΈ
π AUTHOR π
epstool was written by Russell Lang <gsview@ghostgum.com.au> π
This man page was contributed by Martin Pitt <martin@piware.de> for the Debian GNU/Linux system (but may be used by others). πΈ
That's the whole page, bestie!! Written by Martin Pitt and Russell Lang, dated 2005-06-10, and it lives in the manual as EPSTOOL(1). You made it all the way to the bottom of the man page β that's main character energy, fr fr. Go fix those BoundingBoxes. Slay π
β¨π
π¦ where this page comes from
- debian bookworm: epstool 3.09-4 Β· GPL-2.0-or-later
- debian trixie: epstool 3.09-4 Β· GPL-2.0-or-later
- epel 10: epstool 3.08-33.el10_2 Β· GPL-2.0-or-later
- epel 9: epstool 3.08-24.el9 Β· GPLv2+
- fedora 43: epstool 3.08-32.fc43 Β· GPL-2.0-or-later
- fedora 44: epstool 3.08-33.fc44 Β· GPL-2.0-or-later
- nixos 26.05: epstool 3.09
- nixpkgs unstable: epstool 3.09
- ubuntu jammy: epstool 3.09-3 Β· GPL-2.0-or-later
- ubuntu noble: epstool 3.09-4build1 Β· GPL-2.0-or-later
- ubuntu questing: epstool 3.09-4build1
- ubuntu resolute: epstool 3.09-4build2 Β· GPL-2.0-or-later
- ubuntu stonking: epstool 3.09-4build2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms