In this blog, I’ll show how to create an Offset filter for Pixelmator using Quartz Composer on Mac OS/X Snow Leopard.
Pixelmator is a really cool image editor and a great, low-price alternative to Photoshop. Pixelmater is not quite so feature rich as Photoshop and one its the missing feature is the Offset filter. This filter is used a lot when creating tileable textures without visible seams. This filter is extremely simple: It simply tiles the layer and move the layer in one direction.
It is possible to achieve the same effect manually, by creating 4 copies of the layer, moving them to the 4 corners and finally merging the layers. However this approach is both error prone and cumbersome.
Pixelmater does not support scripting, macros or plugins, but it does supports Quartz image filters. Quartz filters is a part of OS/X and defines filters and effects that can be used by applications of the platform. In the following section I’ll show how to create the filter in Quartz Composer. If the implementation does not have your interest, then skip the section and go to the section ‘Installing the Offset Quartz filter’.
Creating the Offset Quartz filter
The first step to create a new Quartz filter is to launch the Quartz Composer. This program is a part of the developer tools and it located here (under Snow Leopard): /Developer/Applications/Quartz Composer.app. If you cannot locate the program, you may need to install the developer tools from the OS/X install disk.
After you have launched the program, choose the ‘Image Filter’ template. Your main window should look something like this:
It basically shows the input image and the two x and y parameters (on the left) goes into the blackbox and returns the final image to the output (on the right). You should also have a few more windows open (if not they can be found under the Window menu or tool bar of the main window):
- Viewer: Shows the result of your filter (the defaults shows a flower with a zoom blur filter on)
- Inspector: Shows you properties of the currently selected element from the main window
- Library: shows you available functions you can use in your filter.
Now you might wonder how the black box in the middle (‘Process the image’) works. To find out, double click on the lower part of box (not the bullets or title) – this will open the container (also called macro patch).
Now delete the three middle patches (Image Space, Zoom Blur and Crop to Original) by left click and delete-key. Also delete the notes by right-click and select delete from menu. Notice that the viewer will turn black when you delete the component.
From the library find and drag in the following components (You can use the search function in the bottom of the library panel):
- Image Dimensions – this will be used to find the dimensions of the image
- Math (we need two instances of this) – simple math operation (such as +,-,x,/)
- Affine Tile – Used for tiling the image
- Image Crop – Used maintaining the same size of the image
You should now have something like this:
The left side of each component are input and the right side are output. You can connect a output to a input by dragging the output knot to a input know. Now connect the components as the following:
We need to change the math operation from + to x (multiplication). To do this, you can double left-click on the + and select x (multiplication). Do this for both math components.
We now need to assign a second input to the two math operations. Right-click on each math component and select ‘Publish Inputs’ -> ‘Operand #1’. In the textbox write X for the upper math component and Y for the lower math component.
Now we are done with the filter, but we need to setup one final thing. Click ‘Edit Parent’ to go to the top view. Connect the ‘X (optional)’ output to X and ‘Y (Optional)’ to Y like this:
Now we are done! To test the filter click the ‘Parameters’ button from the top menu and try to change the Input X and Input Y values. This should result in the offset effect in the viewer. Now save your filter to any location on your harddrive.
Installing the Offset Quartz filter
To install a quartz filter you need to copy the qtz file into the folder /System/Library/Compositions /Library/Compositions (edited 23 okt. thanks to Antony for pointing this out). Since this is a system folder, you may be asked for permission to install the filter.
If you do not have completed the tutorial above, you can download these two complete offset filters:
Alternatively you can just run the following installer, that does the same thing:
Using the filter in Pixelmator