Wednesday 6 October 2010

xcf2pdf

xcf2pdf is a simple python script, that uses convert from ImageMagick to batch convert every xcf image inside a folder to a pdf


#!/usr/bin/python


from subprocess import *

import re


def convert(file):

p = Popen(['convert', file, file[:-3]+'pdf'], stdout=PIPE, stderr=PIPE)


p = Popen('ls', stdout=PIPE, stderr=PIPE)

ls, error = p.communicate()

files = re.split('\n', ls)

for i in files:

if i[-3:]=='xcf':

convert(i)


There are a few features missing and known bugs, e.g. it will convert every layer of the xcf file to a different page in the same pdf. (Beware of the python code formatting)

No comments:

Post a Comment