Create Bitmap Images with GhostScript (Folder Action Script)

28 Dez 2011 - 12:31

The script calls Ghostscript to convert a PostScript print job, EPS files or PDF files to an image in the formats Tiff, JPEG or PNG. As a folder action script, it allows you to create a set of simple conversion folders for different image types and resolutions. Copy a .ps, .eps or .pdf file into such folder to have it converted.
(Modified version February 2012.)

Zur deutschen Version

This script can run as a folder action script. If you run it in the Script Editor, it will prompt you with a choose file dialogue. Note that the original file will be deleted after the process.. The script requires Ghostscript to be installed on your Mac. Information about an installer that worked well on my machines can be found here. Informations about versions from sourceforge are on this page.

This script is a variant of Ghostscript PDF - AppleScript.

Download

For using the script, download here and unpack it.

Controlling the Action using Folder Names

“Bitmap Convert” reacts on the name of the folder(s), it is attached to. It looks for certain words in the folder name:

  • tif or tiff: Create a TIFF file
  • png: Create a PNG file
  • jpg or jpeg: Create a jpeg file
  • psd: Create a Photoshop file
  • Separation: Create a separated TIFF file collection

If no such word is found, PNG is assumed as the default.

In case of tiff files and PSD files, another key word has an effect:

cmyk configures the command to create a CMYK tiff or Photoshop file. Else it will be RGB.

Photoshop CMYK files have the particular advantage that spot colours are preserved: They appear as separate channels in the document.

A separation creates one coloured tiff and one greyscale tiff per plate. This is useful to check if all overprint settings in a document are OK.

If the folder name contains numbers, the first of them sets the resolution of the image created. Is it missing, 72 is assumed.

In case of JPEG files, the script looks for additional numbers. If they exist, the last one in the folder name is interpreted as the JPEG compression qualtity (must be from 0 to 100, where 100 means the highest quality). Is no second number found, 75 is assumed.

Examples for useful folder names for this script:

  • Tiff 150 (RGB TIFF files with a resolution of 150 dpi will be created)
  • Tiff CMYK, 300 (CMYK TIFF files with a resolution of 300 dpi will be created)
  • Jpeg 300, qualitity 90 (JPEG files with a resolution of 300 dpi and a compression quality of 90 will be created)
  • PNG 96 (PNG files with a resolution of 96 dpi will be created)
  • Separation 150 (Separated TIFF, 150 dpi.)
  • PSD 150 CMYK (CMYK Photoshop file, 150 dpi.)

Installing as a Folder Action Script

Use “Go – Go to Folder” in the Finder and enter

/Library/Scripts/Folder Action Scripts

to open the folder where these scripts reside.

Copy or move “Bitmap Convert” to that folder.

Right click any folder that should be used vor conversion and select “Services - Folder Action Setup” to assign the script to that folder.

Source

If you just want to see the code of the AppleScript here it is as HTML file.