[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Filter Services
From: |
Fred Kiefer |
Subject: |
Filter Services |
Date: |
Wed, 15 Feb 2012 23:32:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120129 Thunderbird/10.0 |
During FOSDEM Richard and I discussed the usage of filter services for
image conversion in gui. This is an old topic and I was always to lazy
to implement it. With Eric's image converter with Ghostscript and
Imagemagik there was finally more than enough reason to do it. It turned
out that the code in NSImageRep to support this was easy to write.
Richard just had to rewrite DO for the filter service, which had been
corrupted a few years back, and things were working. Or rather more or
less so.
I used Ink as my test platform and inserted a PS file into a document,
getting its image converted to tiff on the way. It turns out that
NSLayoutManager cannot handle attachments as the last character. I
couldn't find the reason for that up to now. My example service was just
a shell script using Ghostscript, here the problem was that Ghostscript
when used with an output pipe cannot produce correct tiff images
readable with GNUstep. Richard came up with the idea to write into a
temporary file and pipe this back via cat. Next there was a problem
converting the black image that GS produced into RGB, which I managed to
track down today. Still there are tiff images that get displayed
correctly as attachments in Ink and others that wont.
So apart from these little issues filter services are working now for
images!
How to test it:
All you need is a filter program and a service .plist. Attached you will
find the ones I am using to test things. You will need to adjust the
path to the gs.sh shell script.
That we use NSTypedFileContentsPboardType:tiff instead of
NSTIFFPboardType is due to a limitation in the code that converts
between file types and pasteboard types. We should fix that or rather
move on to UTI.
The next step would be to write similar support for pasteboard type
filtering and then to add the same code in NSSound and NSMovie. Add a
proper filter service for ImageMagik (this one would not be a shell
script but rather a DO application). And of course to fix all the issues
listed above.
Hope you have fun with filter services,
Fred
gs.sh
Description: application/shellscript
GSServiceInfo.plist
Description: Text document
- Filter Services,
Fred Kiefer <=