+
+ (rename-file file old)
+ (my-system be-verbose
+ #t
+ (format #f "convert -scale \"~a%\" ~a ~a" percentage old file))
+ (delete-file old)
+ ))
+
+(define-public (ps-page-count ps-name)
+ (let*
+ ((byte-count 10240)
+ (header (gulp-file ps-name byte-count))
+ (first-null (string-index header #\nul))
+ (match (string-match "%%Pages: ([0-9]+)"
+ (if (number? first-null)
+ (substring header 0 first-null)
+ header))))
+
+ (if match
+ (string->number (match:substring match 1))
+ 0)))