LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   How do I print a million dots on a single sheet of 8.5x11 paper? (http://www.linuxquestions.org/questions/slackware-14/how-do-i-print-a-million-dots-on-a-single-sheet-of-8-5x11-paper-4175479012/)

GreyBeard 09-29-2013 08:47 PM

How do I print a million dots on a single sheet of 8.5x11 paper?
 
Hi,

I have something I want to print which is a little off the beaten path,
so to speak. I know next to nothing about printing so I need help. I
am doing this for educational purposes to TRY to get across the concept
of large numbers to elementary school kids.

I want to put exactly one million VISIBLE, distinct dots on one 8.5 x 11
sheet of paper, plus be able to put some comments on the sides, top, or
bottom, and perhaps highlight a few of the dots with color around them
instead of white. I realize that the dots will be quite small. It
would also be nice if the page could be reproduced on a copier tho that
is not a requirement.

I have the following equipment and software: I run 32-bit Linux. I have
a variety of programs which go with my Linux (latest Slackware) such as
EMACS for (maybe?) creating repetitive printer commands and GIMP for
creating and editing images. My printer is an OKI C5300 color laser
printer which, as I understand it, can print emulating Postscript 3 and
PCL 5c. It has a resolution of 600 DPI.

I think I would prefer a rectangular grid like this where * is a dot and
_ is white or light color

_________
_*_*_*_*_
_________
_*_*_*_*_
_________
_*_*_*_*_
_________

which would be more distinct, I think, than a chessboard pattern like this

__________
_*_*_*_*__
__*_*_*_*_
_*_*_*_*__
__*_*_*_*_
_*_*_*_*__
__*_*_*_*_
__________

but a chessboard pattern would be better for improved density. Being able
to try both would be good because you really can't tell how it looks until
you actually see it.

Assuming that I can control each and every printer dot and that I can
print 7.5x10 inches, then I have room for 7.5x10x600x600 == 27,000,000
printer dots on the page. Since I want a million visible dots on a
square grid that means that each visible dot can be
int( sqrt( 27000000 / 1000000 )) == 5 printer dots on each side. Thus
each visible dot would look like the following in printer dots:

_____
_***_ This would allow for 16/25 white and 9/25 black, and there
_***_ would be two rows of white vertically and horizontally
_***_ between each visible dot.
_____

OR
_____
__**_ This would have much more separation between the visible dots
__**_ but the visible, 4/25 black part of the dot would be much
_____ smaller. It's hard to tell whether this or the above would
_____ be more visible when actually on paper.

The above are for the rectangular layout. A checkerboard layout would
alternate cells with visible dots with empty cells, thus giving me 1/2
the visible dot density. Thus my rectangles would be reduced to 3x3.
In order to separate dots at the corners I would have to use something
like one of the following patterns:

_*_
***
_*_

OR

***
***
_*_

Both would give more ink per visible dot than the 4/25 black pattern
above but with much more separation between dots.

Again it's hard to say which of the 4 schemes above would look the best
until I actually see it on paper.

I see three ways of doing these 4 schemes: (1) Issue lots of nearly
repetitive printer commands. (2) Build a glyph with 10x10 visible dots
in it which uses up the entire character cell space and aligns the dots
properly on each side and above and below, and then just print 10,000 of
them in a rectangle which fits on 8.5x11 paper where the last row does
not have to be the size of the other rows. (3) Make an uncompressed,
high resolution image of 1,000,000 dots and just print it, but would
there be problems in translation from image to printer?

I have another question: Assuming again that I can access each printer
dot, can I also control the size of that dot (within reason)?


That's kind of the limit of what I currently can guess for this project.
All useful hints, ideas, suggestions, etc, will be appreciated. Please
reply via this website or via the eMail address I set up for this
project: Jeff.B.million_dots@myLetters.US Also if you know of another
forum where I could ask this question please let me know about it.


Thank you in advance,
Jeff B.

Jeff.B.million_dots@myLetters.US

Richard Cranium 09-29-2013 09:34 PM

I'd probably just build the image using Gimp and print that.

astrogeek 09-29-2013 09:42 PM

I agree with Mr. Cranium, just build up the grid using the Gimp, repeat it as necessary then print.

You might build a few 1x1 inch grids with different size dots to see what gives the best visual results.

mancha 09-30-2013 04:16 AM

1 Attachment(s)
Given you want to annotate, let's put 1/2 inch borders on all 4 sides. This gives an effective printable area of 7.5" x 10".

At 600 DPI we have at our disposal 27,000,000 total dots. It might be too much to expect one to see a 1x1 "dot", so lets make
them 2x2 squares and put them 3 dots apart from their neighbors. This means each "dot" requires a space of 5x5.

We can plot roughly 1,080,000 (just above our 1 million requirement) "dots".

So, we are going to settle on a rectangular grid with 900 "dots" across and 1112 "dots" down. The last row will only have
100 "dots" across not the full 900.

We will highlight about 1% of them by putting a red 1-dot-wide halo around them at regular intervals.

The image will look like this:


Code:

  OO...OO...OO...
  OO...OO...OO...
  ...............
  ...............
  ...............
  OO...OO...OO...
  OO...OO...OO...
  ...............
  ...............
  ...............
  OO...OO...OO...
  OO...OO...OO...
  ...............
  ...............
  ....++++.......
  OO..+OO+..OO...
  OO..+OO+..OO...
  ....++++.......
  ...............
  ...............

O=black
.=white
+=red

We can print it with something like this:

Code:

$ lp -d $printername -o media=letter -o scaling=100 -o page-top=36 \
  -o page-bottom=36 -o page-left=36 -o page-right=36 million.png


--mancha


PS If I got my math right, this image has exactly 1,000,000 "dots". I tried counting them but kept losing track around 700,000.

Habitual 09-30-2013 08:40 AM

Quote:

Originally Posted by mancha (Post 5037191)
I tried counting them but kept losing track around 700,000.

Smart and Funny ;)

mancha 09-30-2013 09:10 AM

1 Attachment(s)
Pesky off-by-one error...my first image had 1,000,001 "dots". This one should be good.

Skaperen 09-30-2013 09:19 AM

I would think 1,000,001 meets the requirement of a million.

mjolnir 09-30-2013 10:32 AM

@mancha Great work. Now if you can just get this paper to work with my LiveScribe Echo smartpen in Linux I'd be a happy camper. ;-)

emgee_1 10-01-2013 02:11 AM

I did not try this yet but how about :

plotting random using R and ggplot2 points with the x and y coordinate from say the interval (0,1) .
Using the capabilities of ggplot2 you can then make every 1000th point a little bigger or different color.

As a side note : if you use NSA random generator you get
the the Snowden: Most Wanted picture :)

I will try a little later to produce something like that

Greetings

Marcel

GreyBeard 10-01-2013 04:43 PM

Mancha,

Hi. And thank you. I was less successful than you at counting
the dots. I couldn't find even one to count when I printed the
page, even with a magnifying glass. It just looked grey.

I don't understand how those .PNG image files you attached
actually work. They are quite small, so either .PNG files have
some sort of built-in replication (I know nothing about how .PNG
files work either.) or I don't understand what the LP command is
doing, especially that -o scaling=100 option. Is that just
telling it to print at 100% of the size or is it scaling it up
by a factor of 100?


Thanks,
Jeff B.

Jeff.B.million_dots@myLetters.US

qweasd 10-01-2013 08:10 PM

better compression
 
May be you find this useful. Save as dots.ps, then
Code:

ps2pdf dots.ps
then cross your fingers and print. Play around with v_dot_size. As given,
this prints into resolvable dots on my 600 dpi laser. Resolvable with a 20x lens.
Unless your eyes are much better than mine, you may be asking for too much if
you want to see individual dots.

Code:

%!PS
%%BoundingBox: 0 0 612.0 792.0

% Ivan Zaigralin a.k.a. Melikamp.
% Copyright (C) 2013.  Licensed under GNU GPL version 3 or later,
% as published by FSF.

% I draw a rectangular grid of dots on the bottom of a letter-sized
% page. All lengths in points, 1 point = 1/72 inch

/v_dot_size 0.05 def % a dot is a square with side this long
/v_dot_x 1000 def % number of dots in row
/v_dot_y 1000 def % number of dots in column
/v_margin 32 def % margin around the dot field

% distance between dot centers is as large as page width and dot size
% allow
/v_dot_spread
    8.5 72 mul % letter width
    v_margin 2 mul sub v_dot_size sub % - 2*margin - dot size
    v_dot_x 1 sub div % over (# of dots - 1)
def

% init
0 setlinewidth
v_margin v_margin translate

/f_draw_dot { % draw dot here
    gsave newpath
        0 0 moveto
        v_dot_size 0 rlineto
        90 rotate
        v_dot_size 0 rlineto
        90 rotate
        v_dot_size 0 rlineto
    closepath fill grestore
} def

% let's draw already!

v_dot_y {
    gsave
        v_dot_x {
            f_draw_dot
            v_dot_spread 0 translate
        } repeat
    grestore
    0 v_dot_spread translate
} repeat

showpage


mancha 10-02-2013 06:51 PM

@qweasd:

I really enjoyed this approach!

One suggestion I have is to use 800x1250 dots (rather than 1000x1000) to make better use of the paper's real estate (see below):

Code:

%!PS
%%BoundingBox: 0 0 612.0 792.0

% Ivan Zaigralin a.k.a. Melikamp.
% Copyright (C) 2013.  Licensed under GNU GPL version 3 or later,
% as published by FSF.

% I draw a rectangular grid of dots on the bottom of a letter-sized
% page. All lengths in points, 1 point = 1/72 inch

/v_dot_size 0.05 def % a dot is a square with side this long
/v_dot_x 800 def % number of dots in row
/v_dot_y 1250 def % number of dots in column
/v_margin 32 def % margin around the dot field

% horizontal distance between dot centers is as large as page width
% and dot size allow
/v_dot_spread_x
    8.5 72 mul % letter width
    v_margin 2 mul sub v_dot_size sub % - 2*margin - dot size
    v_dot_x 1 sub div % over (# of dots - 1)
def

% vertical distance between dot centers is as large as page length
% and dot size allow
/v_dot_spread_y
    11 72 mul % letter length
    v_margin 2 mul sub v_dot_size sub % - 2*margin - dot size
    v_dot_y 1 sub div % over (# of dots - 1)
def

% init
0 setlinewidth
v_margin v_margin translate

/f_draw_dot { % draw dot here
    gsave newpath
        0 0 moveto
        v_dot_size 0 rlineto
        90 rotate
        v_dot_size 0 rlineto
        90 rotate
        v_dot_size 0 rlineto
    closepath fill grestore
} def

% let's draw already!

v_dot_y {
    gsave
        v_dot_x {
            f_draw_dot
            v_dot_spread_x 0 translate
        } repeat
    grestore
    0 v_dot_spread_y translate
} repeat

showpage

Also, with the variant below of the main loop, 1% of the dots will be red (not black). Note, this'll likely take a lot longer to print since it calls a prng 10^6 times.

Code:

v_dot_y {
    gsave
        v_dot_x {
            rand 21474836 lt {
              1 0 0 setrgbcolor
            } {
              0 0 0 setrgbcolor
            } ifelse
            f_draw_dot
            v_dot_spread_x 0 translate
        } repeat
    grestore
    0 v_dot_spread_y translate
} repeat

@Greybeard:

About PNG, it achieves the small file size by using loss-less compression. This is in contrast to other formats such as JPEG which use lossy compression.

If you use qweasd's solution, which I think you should, and you have a network printer, you can send the postscript file directly:

Code:

$ nc -q 2 my.printer.here 9100 < million.ps
--mancha


All times are GMT -5. The time now is 04:19 PM.