#!/bin/sh # converts .pictClipping to TIFF # by Peter van Dijk & Marloes de Boer # info & downloadlink at # http://www.liessa.net/2007/02/05/habbies-present-converting-pictclipping-files/ if [ -z "$1" ] then echo -e "\tconverts .pictClipping to .tiff" echo -e "\tUsage: $0 " exit 1 fi basefilename="${1%.pictClipping}" if [ "$basefilename" = "$1" ] then echo "This script only supports .pictClipping files" exit 1 fi datasource="${basefilename}.pictClipping/..namedfork/rsrc" # tiff header begins with either 49 49 2A 00 (II) or 4d 4d 00 2A (MM) - endian info # bytes from begin file to begin line containing tiff-start offset1=$(egrep -ba -m 1 '(II|MM)' "$datasource" | cut -d: -f1) # bytes from begin line to tiff-start offset2=$(egrep -a -m 1 '(II|MM)' "$datasource" | perl -pe 'chomp(); s/II.*|MM.*//' | wc -c) # total offset in bytes offset=$[$offset1+$offset2] # copy tiff-part of file to new file with .tiff extention dd if="$datasource" bs=1 skip="$offset" of="$basefilename".tiff # and display 'file'-output file "$basefilename".tiff