print to a printer from Max/Jitter

Peter Nyboer's icon

I know this has been asked before, but I can't find it...what sort of printing automation schemes have people come up with in Max? I'd like to be able to export a tiff file from a jit.matrix and print it automagically. Any suggestions or examples?

Joshua Kit Clayton's icon

On Aug 30, 2006, at 3:11 PM, pnyboer wrote:

> I know this has been asked before, but I can't find it...what sort
> of printing automation schemes have people come up with in Max?
> I'd like to be able to export a tiff file from a jit.matrix and
> print it automagically. Any suggestions or examples?

Might want to check out the Java Printin APIs:

Also might want to investigate the Common Unix Printing System on OS
X, and possibly Cygwin on windows:
http://www.cups.org/documentation.php

"man -k cups"

Don't know that much about either, but between these and potential
other commandline utilities you should be able to figure something
out. And then there's always the ability to write a C external to get
the job done with Platform specific APIs if you want.

Have fun...

-Joshua

Johnny deKam's icon

how about Applescript or Automator?

you can write an applescript telling 'Preview' to open and print and
image and then attach it to a folder

or do the same thing with Automator, save that as an 'application'
then a simple folder-action to open that file with the
'application' (workflow) you made

-deKam

>
> I know this has been asked before, but I can't find it...what sort
> of printing automation schemes have people come up with in Max?
> I'd like to be able to export a tiff file from a jit.matrix and
> print it automagically. Any suggestions or examples?

Peter Nyboer's icon

Thanks for the helps!
Applescript is a possibility...I started going the shell route, which worked...almost. Of course my printer doesn't seem to support the lpr option "ppi" so it want to prints big at low-res. Imagemagick was then installed, which works from Terminal, but the same command thru the shell object doesn't do the trick:

convert -density 200 /Volumes/HardDrive/Users/me/Desktop/test.tif /Volumes/HardDrive/Users/me/test2.tif

Has anyone used imagemagick with shell? Hmmm...very attractive fi i git it werkin'...

P.

ps - imagemagick installer for osx is here:
http://www.entropy.ch/software/macosx/#imagemagick

for the sake of sharing, here's my patch so far....

Max Patch
Copy patch and select New From Clipboard in Max.


mattyo's icon

I don't know if this is useful information, but I've successfully run
Perl scripts in shell which call imagemagick.....

M

On Aug 31, 2006, at 2:01, pnyboer wrote:

>
> Thanks for the helps!
> Applescript is a possibility...I started going the shell route,
> which worked...almost. Of course my printer doesn't seem to
> support the lpr option "ppi" so it want to prints big at low-res.
> Imagemagick was then installed, which works from Terminal, but the
> same command thru the shell object doesn't do the trick:
>
> convert -density 200 /Volumes/HardDrive/Users/me/Desktop/test.tif /
> Volumes/HardDrive/Users/me/test2.tif
>
> Has anyone used imagemagick with shell? Hmmm...very attractive fi i
> git it werkin'...
>
> P.
>

yair reshef's icon

i second doing this with perl+imagemagik thru a batch files (done in
windowz)

2006/9/1, mattyo :
>
> I don't know if this is useful information, but I've successfully run
> Perl scripts in shell which call imagemagick.....
>
> M
>
>
> On Aug 31, 2006, at 2:01, pnyboer wrote:
>
> >
> > Thanks for the helps!
> > Applescript is a possibility...I started going the shell route,
> > which worked...almost. Of course my printer doesn't seem to
> > support the lpr option "ppi" so it want to prints big at low-res.
> > Imagemagick was then installed, which works from Terminal, but the
> > same command thru the shell object doesn't do the trick:
> >
> > convert -density 200 /Volumes/HardDrive/Users/me/Desktop/test.tif /
> > Volumes/HardDrive/Users/me/test2.tif
> >
> > Has anyone used imagemagick with shell? Hmmm...very attractive fi i
> > git it werkin'...
> >
> > P.
> >
>
>

yair reshef's icon

for reference, this Perl script does the following:
opens a word document and run appointed macro on it (the macro saves doc
file as unicode txt file), it then creates new text files containing only
one line, in reversed char order (Hebrew support is hell).
using imagemagic it then convert each one line txt file into a gif file. for
max to use.

#!/usr/bin/env perl
use Win32::OLE;
use File::DosGlob;
use utf8;
# Launch new instance of Word
my $wrd = Win32::OLE->new('Word.Application');

$wrd->{'Visible'} = 0;

# First argument to script is the name of the macro
my $macro_to_run = shift @ARGV;

# Everything else is a document on which to run macro
foreach $arg (@ARGV) {

# Expand any wildcards that might be in the argument
#the current word macro turns a doc into a unicode txt file
foreach $file (File::DosGlob::glob($arg)) {
my $file_full_name = Win32::GetFullPathName($file);
my $doc = $wrd->{'Documents'}->Open($file_full_name);
$wrd->Run($macro_to_run);
$doc->Close();
###end of word macro
$filename= $arg.'.txt' ;
open FILE, "$filename"; #opens the newly created txt file
binmode(FILE, ":utf8"); #make it unicode as we are working in hebrew
@lines = ;
#now the each word is reversed and each line is outputed
# into a sequance of txt lines one line per file
$a=0;
do{
$tempdel = "tmp$a".'.txt' ;
open FH, ">:utf8", "$tempdel" ;
@letters=split (//,$lines[$a]);
print FH reverse @letters ; #prints to hebrew
# This is the full path to the convert element from imagemagic.
#this takes the indevidual txt files and convert them to jpg's
#this script is a (primitive) hebrew subtitle creator
$imagelibpath = 'convert.exe -background black -pointsize 36 -fill
white -gravity Center label:@'.$tempdel." " .$tempdel.'.gif';
system $imagelibpath ;
$a++ ;
} while($a

}
}
#delete temp txt files
unlink ;
$wrd->Quit(); #end prog

2006/9/1, yair reshef :
>
> i second doing this with perl+imagemagik thru a batch files (done in
> windowz)
>
> 2006/9/1, mattyo < news@ostrowski.info>:
>
> > I don't know if this is useful information, but I've successfully run
> > Perl scripts in shell which call imagemagick.....
> >
> > M
> >
> >
> > On Aug 31, 2006, at 2:01, pnyboer wrote:
> >
> > >
> > > Thanks for the helps!
> > > Applescript is a possibility...I started going the shell route,
> > > which worked...almost. Of course my printer doesn't seem to
> > > support the lpr option "ppi" so it want to prints big at low-res.
> > > Imagemagick was then installed, which works from Terminal, but the
> > > same command thru the shell object doesn't do the trick:
> > >
> > > convert -density 200 /Volumes/HardDrive/Users/me/Desktop/test.tif /
> > > Volumes/HardDrive/Users/me/test2.tif
> > >
> > > Has anyone used imagemagick with shell? Hmmm...very attractive fi i
> > > git it werkin'...
> > >
> > > P.
> > >
> >
> >
>
>

nab@baginsky.de's icon

Hi everyone,
lpr works just fine, also for high resolutions. as long as the image you are printing is saved with that resolution cups will respect that and print in the apropriate size.
you can write a very simple shell script that starts lpr and then call that script from your application. I have only done this with pd but there should be no problem doing this with max. in pd there is a "shell" object that makes the trick.
a shell script could look like this:
-------------
#!/bin/bash

lpr $1

# the var $1 will be replaced with the first command line arg
-------------

and the shell object would look like this

[shell scriptname printfilename]

only you have to use absolute paths to make this work

good luck, n.

Peter Nyboer's icon

I think Perl is more than I need. lpr works fine here too, but the problem is that an image exported from jitter has a density of 72 dpi. So I thought imagemagick would do the trick of changing the density to whatever I wanted. I guess I could write a shell script as a work around and call that script from Max using the "shell" object - that is a good suggestion.
But ultimately that doesn't enlighten me as to why the same command (with full paths) in the Terminal doesn't work with shell! Hmm...maybe I'll send a mail to shell's author...

Thanks!

Peter.

dhimage's icon

if you are taking about tiff printing scheme. i think i am just print multi-page tiff files without installing another extra tool.

zaza von schplurk's icon

Have you checked your printer preferences in cups?
Maybe this is the place to set a bigger resolution than 72 dpi.
http://localhost:631/admin

tiff2ps could be a shell command to investigate too.