Forums > Jitter

print to a printer from Max/Jitter

August 30, 2006 | 10:11 pm

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?


August 30, 2006 | 10:36 pm

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:

http://java.sun.com/j2se/1.4.2/docs/guide/jps/index.html

http://java.sun.com/docs/books/tutorial/2d/printing/index.html

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.

Example on OS X

http://developer.apple.com/samplecode/PMPrinterPrintWithFile/index.html

Examples on PC:

http://www.codeproject.com/printing/

Have fun…

-Joshua


August 31, 2006 | 1:53 am

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?


August 31, 2006 | 6:01 am

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….

#P window setfont Geneva 9.;
#P window linecount 1;
#P message 275 243 212 196617 NoNokDuHuis:/Users/yowstar/Desktop/test;
#P newex 104 164 30 196617 t b b;
#P newex 233 300 65 196617 print export;
#P button 68 287 15 0;
#P button 215 356 15 0;
#P message 552 221 174 196617;
#P newex 279 509 72 196617 print sh-print;
#P newex 303 418 85 196617 print sh-convert;
#P newex 271 418 31 196617 shell;
#P newex 274 454 63 196617 pack lp path;
#P newex 529 219 14 196617 _;
#P message 465 366 271 196617 /Volumes/NoNokDuHuis/Users/yowstar/Desktop/test.tif;
#P newex 121 270 129 196617 pack exportimage path tiff;
#P newex 271 396 174 196617 pack convert -density 200 path path;
#P newex 331 60 52 196617 metro 33;
#P objectname gate[11];
#P newex 194 58 20 196617 t b;
#P objectname gate[10];
#P newex 168 58 20 196617 t b;
#P objectname gate[9];
#P newex 168 37 43 196617 cycle 2;
#P objectname gate[8];
#P message 333 37 30 196617 read;
#P message 241 17 80 196617 read dozer.mov;
#P message 245 34 83 196617 read dishes.mov;
#P newex 316 481 60 196617 print print!;
#P newex 252 55 63 196617 jit.qt.movie;
#P newex 271 368 30 196617 t b b;
#P newex 274 485 31 196617 shell;
#P newex 212 328 93 196617 route exportimage;
#P user jit.pwindow 334 296 82 62 0 1 0 0 1 0;
#P user jit.pwindow 108 336 82 62 0 1 0 0 1 0;
#P number 104 49 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 27 177 27 196617 t i i;
#P objectname gate[7];
#P newex 49 108 21 196617 t 1;
#P objectname gate[6];
#P newex 27 226 21 196617 t 0;
#P objectname gate[5];
#P newex 30 201 38 196617 sel 16;
#P objectname gate[4];
#P toggle 33 61 15 0;
#P newex 45 83 41 196617 sel 1 0;
#P objectname gate[3];
#N counter 1 16;
#X flags 0 0;
#P newobj 29 154 68 196617 counter 1 16;
#P objectname gate[2];
#P newex 28 131 58 196617 metro 200;
#P objectname gate[1];
#P button 461 51 15 0;
#P newex 461 98 27 196617 – 1;
#P newex 461 78 40 196617 uzi 16;
#N thispatcher;
#Q end;
#P newobj 461 146 61 196617 thispatcher;
#P message 461 118 147 196617 script connect gate $1 glue $1;
#P newex 99 191 209 196617 gate 16 1;
#P objectname gate;
#P newex 99 215 209 196617 jit.glue @rows 4 @columns 4;
#P objectname glue;
#P user jit.pwindow 323 144 82 62 0 1 0 0 1 0;
#P newex 114 112 129 196617 jit.matrix 4 char 300 225;
#P newex 98 290 129 196617 jit.matrix 4 char 900 675;
#P newex 114 81 37 196617 r mov;
#P user dropfile 552 146 713 207 1;
#P window setfont Geneva 14.;
#P window linecount 2;
#P comment 537 270 397 196622 Make a grid of images , export to tiff , use imagemagick to resize to 200dpi , then print;
#P window setfont Geneva 9.;
#P window linecount 1;
#P comment 539 322 378 196617 imagemagic for os x – http://www.entropy.ch/software/macosx/#imagemagick;
#P connect 15 0 21 0;
#P connect 18 0 19 0;
#P connect 17 0 14 0;
#P connect 14 0 15 0;
#P connect 21 1 18 0;
#P fasten 19 0 17 0 32 251 15 245 23 61;
#P connect 17 0 16 0;
#P connect 16 0 20 0;
#P connect 20 0 15 2;
#P connect 38 0 4 0;
#P connect 7 0 4 0;
#P connect 21 0 8 0;
#P connect 49 1 7 0;
#P connect 8 0 7 0;
#P connect 15 0 22 0;
#P connect 16 1 49 0;
#P connect 4 0 23 0;
#P connect 8 1 7 1;
#P connect 28 0 5 0;
#P connect 3 0 5 0;
#P connect 47 0 38 0;
#P connect 49 0 38 0;
#P connect 8 2 7 2;
#P connect 8 3 7 3;
#P connect 8 4 7 4;
#P connect 8 5 7 5;
#P connect 22 0 33 0;
#P connect 33 0 34 0;
#P connect 8 6 7 6;
#P connect 50 0 38 1;
#P connect 8 7 7 7;
#P connect 33 1 35 0;
#P connect 8 8 7 8;
#P connect 4 1 25 0;
#P connect 25 0 46 0;
#P connect 8 9 7 9;
#P connect 8 10 7 10;
#P connect 4 1 48 0;
#P connect 34 0 31 0;
#P connect 8 11 7 11;
#P connect 35 0 30 0;
#P connect 36 0 28 0;
#P connect 32 0 28 0;
#P connect 31 0 28 0;
#P connect 30 0 28 0;
#P connect 8 12 7 12;
#P connect 8 13 7 13;
#P connect 25 0 27 0;
#P connect 27 0 37 0;
#P connect 37 0 42 0;
#P connect 42 1 41 0;
#P connect 41 0 26 0;
#P connect 26 0 44 0;
#P connect 26 1 44 0;
#P connect 8 14 7 14;
#P connect 8 15 7 15;
#P connect 5 0 8 1;
#P connect 42 1 43 0;
#P connect 42 0 43 0;
#P connect 41 0 29 0;
#P connect 5 0 6 0;
#P fasten 39 0 41 1 470 443 332 443;
#P connect 17 0 36 0;
#P connect 7 0 24 0;
#P fasten 39 0 37 3 470 388 399 388;
#P fasten 39 0 37 4 470 388 440 388;
#P connect 13 0 11 0;
#P connect 11 2 12 0;
#P connect 12 0 9 0;
#P connect 9 0 10 0;
#P connect 27 1 39 0;
#P connect 2 0 40 0;
#P connect 40 0 45 0;
#P window clipboard copycount 51;


September 1, 2006 | 10:20 am

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.
>


September 1, 2006 | 11:13 am

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.
> >
>
>


September 1, 2006 | 11:21 am

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< =$#lines )

}
}
#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.
> > >
> >
> >
>
>


September 1, 2006 | 2:30 pm

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.


September 1, 2006 | 4:19 pm

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.


October 27, 2013 | 9:19 pm

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


October 31, 2013 | 8:44 am

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.


Viewing 11 posts - 1 through 11 (of 11 total)