Decreasing bitmap resolution when exporting PDFs in Inkscape

When exporting a document with bitmap images in it, Inkscape won’t downsample them to a lower resolution, despite the “Resolution for rasterization (dpi)” setting in the PDF export dialog. That export dialog setting only applies to bitmaps that have had filters applied against them. See bug 246677.

4 years ago I figured out how to work around this and today I had to relearn it. So as to not repeat this in another 4 years, I’m documenting this here for posterity.

The workaround is to apply an identity filter to each bitmap before saving it. An identity filter is one that doesn’t do anything, but because it is a filter it forces Inkscape to do the downsampling upon export. Because an identity filter doesn’t actually do anything, there isn’t one available in the Filters menu, but we can create one.

To create a reusable identity filter:

  1. Open a new Inkscape file
  2. From the Filters menu, select Filter Editor…
  3. In the Filter Editor pane, click the New button. This will add the filter “filter1” to the Filter list
  4. Double click “filter1” and rename it “Identity”
  5. To the right of the Add Effect: button there is a drop-down. Change it to Color Matrix, and hit the Add Effect: button
  6. Save the document as “Identity filter.svg”
  7. Now put the file where Inkscape can find it:
    • Linux/OS X: ~/.config/inkscape/filters
    • Windows XP: C:\Documents and Settings\[USERNAME]\Application Data\Inkscape\filters
    • Windows Vista and later: C:\Users\[USERNAME]\AppData\Roaming\Inkscape\filters
  8. The ‘filters’ directory may not exist, in which case just create it.
  9. Close and restart Inkscape
  10. This should add the Personal submenu under the Filters menu which should include our Identity filter.

To use the identity filter:

  1. In your Inkscape file, select the bitmaps you want to downsample. Be sure not to select any vector images or text since you don’t want to rasterize that.
  2. From the Filters menu, select Personal > Identity
  3. Now when you save the document as a PDF, adjust the “Resolution for rasterization (dpi)” setting. 90 is a decent number for documents that are being viewed on a computer screen. 150 is probably the smallest you want to go for anything that is being printed.

Accessing shared music from Fedora on iTunes

At work, I have my music collection on my Fedora desktop. At times I’ve wanted to access this library on my Mac Book Air but have been unable to do so given they are on two separate subnets (and DAAP is a broadcast protocol). The solution was Network Beacon.

In short:

  1. Ensure your DAAP server is accessible. For Rythmbox, enable/configure the DAAP Music Sharing plugin (be sure to click the ‘Share my music’ checkbox for the plugin).
  2. Make sure port 3689 is open on your Linux firewall if necessary.
  3. On the Mac, download and install Network Beacon and configure a new beacon thusly:
    1. Beacon Enabled: Yes
    2. Service Name: [string of your choice]
    3. Service Type: _daap._tcp
    4. Port Number: 3689
    5. Enable Host Proxy: Yes
    6. Host Name: [full hostname]
    7. IP Address: [duh]
  4. Now you should be able to open iTunes and see the DAAP share appear in the SHARED section. Note that Network Beacon must remain running for iTunes to see the remote share.

Note that if the machines were on the same subnet you should be able to skip Network Beacon entirely and just enable the DAAP Music Sharing and punch the hole through the Linux firewall.

Introducing Seregil, my new MacBook Pro

Yesterday I received my new 15″ MacBook Pro from FedEx and I’m sure I’ll be spending the next several evenings getting it all set up. I’ve christened it Seregil from the character of Lynn Flewelling’s Nightrunner series. (I always name my computers from characters in books — usually those I’m reading or have read recently.) It is spec’d out thusly:

  • MacBook Pro
  • 15″ high-density anti-glare screen
  • i5 2.4GHz CPU
  • 8GB RAM
  • 128GB SSD

For the past 4 years I’ve used Linux systems exclusively and when it came to purchase a new computer I decided to jump to Mac. Moving to Linux from Windows was the most productivity-enhancing change I’ve ever made and I’m hoping the swap to Mac doesn’t set me back. What appeals to me so much about Macs is that they have the classic unix underpinnings with an elegant GUI.

Currently I have a Windows VM which I use solely to put music on my iPhone. That’s going straight to /dev/null. Instead I’ll be creating a Fedora 13 (14?) VM as a backup for those things that just need a Linux touch to them. For instance, I’m going to give Apple Mail a chance, but if it just doesn’t pan out, I’ll run Evolution on the VM using VMware Fusion with Unity. I’m interested to see if The Gimp, Inkscape, and other X-Windows dependent apps behave better running in the VM rather than directly on the OS X X-server. While they function well, they just aren’t really integrated into the OS X UI.

I already have Adium, Unison, Moneydance, LibreOffice (aka: OpenOffice), and Chrome installed and configured. My iPhone library is moved over and correctly synching with my phone thanks to a bit of work getting the Library IDs sync’d between the two. Now to get VMware Fusion installed and that Linux VM created.

I’m a spot color guy living in a process color world

Growing up in a print shop gives me a unique knowledge of all things print. Stray too far outside of the spot color domain however and I have to start getting resourceful.

My family’s business has always used offset presses. And even while they have T-heads to enable the simultaneous printing of 2 colors — the ink has always been Pantone spot colors. This means that whatever we designed, be it on the old negative-creating typesetter circa 1980 or Adobe InDesign, would come out black-and-white in the end to be “converted” to a single spot color on the presses. [Aside: I’m not even going to get into the use of halftone screens and the camera in order to make printable photos — lets just gloss all over that and say it all ended up in black and white.] At no time did I ever need to delve into the process color domain. I knew it existed, I grok the basic concepts, but I didn’t have to concern myself with it.

Recently Benjamin was designing a banner in Inkscape that was to be printed by a 3rd party vendor who specifically requested the document be in CMYK. I dug around and discovered that while Inkscape has some tentative support for CMYK, it is unable to export EPS files in that color space. The work-around is to import the SVG file into Scribus and create the EPS from there as Scribus has better color management support. The tricky part is that Benjamin had used three high-resolution JPEGs in the SVG — JPEGs that were in the sRGB color space. I attempted to use jpegicc utility from littlecms to convert the image from the sRGB color space to a CMYK color space using an Adobe ICC file which succeeded. However, viewing these images did not give me a comfortable feeling that they would look good in print. I ended up punting the work altogether and asked a friend to use Adobe PhotoShop to do the conversion. I was then able to do the Inkscape -> Scribus route to get the final EPS format.

The banner was reported shipped yesterday. Hopefully my color space wrangling worked and it’ll look good upon arrival.

Copy/paste between Mac OS X and X11 apps

Yesterday Benjamin was having some challenges trying to copy text out of OpenOffice (a full Aqua app) and paste it into an Inkscape (an X11 app) document he was creating. The challenge was that it wasn’t working.

After digging around a bit I discovered that the X11 app didn’t have pasteboard syncing enabled. To fix this we went into the Preferences for the X11 app, selected the Pasteboard tab, and enabled syncing using only the ‘Update PRIMARY when Pasteboard changes’ option. Problem solved!

Unfortunately it also messes up copying and pasting vector images from within Inkscape. Looks like this is a setting that will have to be toggled on and off based on what you want to be doing for your copy/paste action. Rather a pain I think.

X11 apps under Mac OS X and Fonts

One of the odd challenges I encountered with getting Inkscape working on Sebastian were the fonts. The fonts showed up in the usual slew of non-X11 applications but refused to show up in Inkscape. I admit to not have tried the Gimp in this state although I assume this is a fonts-in-X11-apps issue and not specifically Inkscape and thus the Gimp would have had the same problems.

A bit of googling resulted in this forum post that solved the problem nicely.

Macs present both a system-specific (under /Library) and user-specific (under [User]/Library) view of several system resources, such as Fonts. The concept being that a specific user can install a resource under their login ID ([User]/Library/Fonts) and that resource is only available for that user’s login ID. Logging in as another user would not expose those resources. The end-user helpfully sees a superset of both the System and User resources exposed to them in the interface.

If you want a resource made available to all users on the system you place them in the System resources instead of the User resources and in order to install a System resource a privilege escalation is required. Like any good OS this helps limit the damage that any given user can inflict to the system.

Extrapolating from my geek knowledge, it appears the core of the issue is how X11 interacts with user resources — or rather how it doesn’t interact with them. My suspicion is that the X11 subsystem only pulls the System fonts, and not the superset of the System and User fonts, which is the reason why moving fonts from the User resources to the System resources caused them to show up in Inkscape.

Next up on my Mac OS X to-investigate list: making printer defaults stick in X11 apps.

Working some PDF magic: CutePDF and pdftk

Over the past several years Benjamin has developed several documents for use with his business, Memento & Co. These documents are designed in Word and originally had the letterhead on them as well. This proved problematic when we moved because in order to update the contact information he had to open and change each and every document. Word doesn’t provide a way to single-source documents and we decided we needed to do this differently.

B had been using CutePDF to create PDFs of his Word documents for a while so I started poking around to see if there was a way to “merge” two PDFs together: we’d create one PDF with the letterhead that he could use to merge on the first page of Word document printed to a PDF. I discovered pdftk would do the trick. Using this technique B was able to design his letterhead in Inkscape and save it as a PDF document. Using Inkscape allowed for a crisp logo (also designed in Inkscape) and no longer required rasterizing the vector logo into a high-resolution image just to place it into a Word document! He could then run a VB script I write which would prompt for the PDF onto which the letterhead should be applied and the script called pdftk to do the actual work.

Now enter the move to Sebastian and Mac OS X. Initially the process seemed much simpler. OpenOffice can export to a PDF out-of-the-box removing the need for CutePDF. Automator can apply a watermark to a PDF but only if the watermark is a raster image, not another PDF. Moreover it doesn’t tell you that anywhere but simply doesn’t do anything to the desired file making it a frustrating task to figure out what was going wrong. Drat, we’d have to go back to pdftk.

Getting pdftk on the system was a bit more challenging as the program doesn’t come in a DMG. Luckily it is included as a port so the process was a simple ‘port install pdftk’. I then used the Automator to provide a Finder menu option that B can use to apply the letterhead to one or more files. The Automator calls a shell script that calls pdftk to do the actual work.