ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Dithering (off-topic)
@ 2003-10-31 11:21 Michal Kvasnicka
  2003-10-31 12:37 ` Bill McClain
  2003-10-31 15:17 ` Siep Kroonenberg
  0 siblings, 2 replies; 5+ messages in thread
From: Michal Kvasnicka @ 2003-10-31 11:21 UTC (permalink / raw)


Good evening.

I apologize to ask a little off-topic question, but I don't know where 
to ask (and it is closely related to TeX and PDF).

I typeset a church bulleting. It is printed on a laserjet printer (600 
dpi), and then copied on a copy machine. As for letters, all is right. 
But figures (photos) are this way spoiled. I guess it would help either 
to force PDF to print the figures in some very low resolution (150 dpi), 
or (probably better) to dither the figures and include them in PNG 
(instead of ordinary JPEG). Can some of you tell me how to do it? I 
tried ImageMagick's convert to dither the photos, but outcomes were 
really poor. Is there some good free software for this (in the best case 
in Linux)? Or can I do it some way in PDF?

Many thanks for any hint.
Michal Kvasnicka

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dithering (off-topic)
  2003-10-31 11:21 Dithering (off-topic) Michal Kvasnicka
@ 2003-10-31 12:37 ` Bill McClain
  2003-11-04 13:34   ` Michal Kvasnicka
  2003-10-31 15:17 ` Siep Kroonenberg
  1 sibling, 1 reply; 5+ messages in thread
From: Bill McClain @ 2003-10-31 12:37 UTC (permalink / raw)


On Fri, 31 Oct 2003 12:21:48 +0100
Michal Kvasnicka <quasar@econ.muni.cz> wrote:

> I typeset a church bulleting. It is printed on a laserjet printer (600
> 
> dpi), and then copied on a copy machine. As for letters, all is right.
> 
> But figures (photos) are this way spoiled. I guess it would help
> either to force PDF to print the figures in some very low resolution
> (150 dpi), or (probably better) to dither the figures and include them
> in PNG (instead of ordinary JPEG). Can some of you tell me how to do
> it? I tried ImageMagick's convert to dither the photos, but outcomes
> were really poor. Is there some good free software for this (in the
> best case in Linux)? Or can I do it some way in PDF?

I suspect you need to halftone the photos before including them. All the
gray pixels must be converted into a pattern of black and white
equivalents.

On Linux you have the netpbm package which has everything you need. The
specific utility is pgmtopbm with various switches. There are other
utilities for converting to and from the netpbm file formats.

Here is an example of a pipeline I use to do several manipulations at
once:

   pnmscale -width=1950 pleiades.pnm | pnmsmooth -size 5 5 | pgmtopbm
-fs -value 0.5 | pnmtopng > pleiades.png

pnmscale: expand to a known size
pnmsmooth: try to obscure the halftone of the original photo
pgmtopbm: apply new halftone, -fs = "floyd-steinberg" halftoning
pnmtopng: convert to png for inclusion into pdf

The trouble with halftone images is that they are not
resolution-independent. You may have to adjust the image size
and parameters depending on your printer. Also, halftoned images do not
display well in some graphics programs, although acroread does a pretty
good job when they are included in pdf files.

-Bill
-- 
Sattre Press                                The King in Yellow
http://sattre-press.com/                 by Robert W. Chambers
info@sattre-press.com             http://kiy.sattre-press.com/ 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dithering (off-topic)
  2003-10-31 11:21 Dithering (off-topic) Michal Kvasnicka
  2003-10-31 12:37 ` Bill McClain
@ 2003-10-31 15:17 ` Siep Kroonenberg
  1 sibling, 0 replies; 5+ messages in thread
From: Siep Kroonenberg @ 2003-10-31 15:17 UTC (permalink / raw)


On Fri, Oct 31, 2003 at 12:21:48PM +0100, Michal Kvasnicka wrote:
> Good evening.
> 
> I apologize to ask a little off-topic question, but I don't know where 
> to ask (and it is closely related to TeX and PDF).
> 
> I typeset a church bulleting. It is printed on a laserjet printer (600 
> dpi), and then copied on a copy machine. As for letters, all is right. 
> But figures (photos) are this way spoiled. I guess it would help either 
> to force PDF to print the figures in some very low resolution (150 dpi), 
> or (probably better) to dither the figures and include them in PNG 
> (instead of ordinary JPEG). Can some of you tell me how to do it? I 
> tried ImageMagick's convert to dither the photos, but outcomes were 
> really poor. Is there some good free software for this (in the best case 
> in Linux)? Or can I do it some way in PDF?
> 
> Many thanks for any hint.
> Michal Kvasnicka

A PostScript solution: create a dvips header file for course
rasterization:

%!
/bop-hook {53 45{dup mul exch dup mul
  add 1. exch sub}setscreen} def

These numbers (raster frequency and angle) are probably ok for
600dpi; otherwise, experiment a bit.

Call it coarse.pro and give dvips a parameter -h coarse.pro

-- 
Siep Kroonenberg
siepo@cybercomm.nl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dithering (off-topic)
  2003-10-31 12:37 ` Bill McClain
@ 2003-11-04 13:34   ` Michal Kvasnicka
  2003-11-04 15:48     ` Bill McClain
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Kvasnicka @ 2003-11-04 13:34 UTC (permalink / raw)


Dear Sir,

many thanks for your kind help. This is precisely what I was searching for.

Bill McClain wrote:

>   pnmscale -width=1950 pleiades.pnm | pnmsmooth -size 5 5 | pgmtopbm
>-fs -value 0.5 | pnmtopng > pleiades.png
>

BTW, is there some easy way to set the size of the dithering points (eg. 
2x2 pixels, 3x3 pixels), or should I do it ex post in some image editor 
(Gimp, imagemagick)?

Many thanks once more.
M.K.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dithering (off-topic)
  2003-11-04 13:34   ` Michal Kvasnicka
@ 2003-11-04 15:48     ` Bill McClain
  0 siblings, 0 replies; 5+ messages in thread
From: Bill McClain @ 2003-11-04 15:48 UTC (permalink / raw)


On Tue, 04 Nov 2003 14:34:54 +0100
Michal Kvasnicka <quasar@econ.muni.cz> wrote:

> BTW, is there some easy way to set the size of the dithering points
> (eg. 2x2 pixels, 3x3 pixels), or should I do it ex post in some image
> editor (Gimp, imagemagick)?

I haven't studied the Floyd-Steinberg algorithm, but it seems to be an
error-difusion technique that handles that automatically. The
resulting pixel dimensions of the image are the same as the
original. There are other halftoning methods you can experiment with in
pgmtopbm.

Although I did some experimentation, I am by no means an expert at this.
My method is simply to expand the orginal image to so that a pixel in
the image will be a dot on the output. Using the example I posted
before, the image was 3.5 inches wide, the printer was 600 dots per
inch, so I sized the graphic to 3.5 x 600 = 1950 pixels before
halftoning. I've dealt with only one printer so far, but the results
have been good.

Depending on the original grayscale image, it may need to be normed
(pgmnorm) or smoothed (pgmsmooth) before halftoning.

-Bill
-- 
Sattre Press                                      Pagan Papers
http://sattre-press.com/                    by Kenneth Grahame
info@sattre-press.com              http://pp.sattre-press.com/ 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-11-04 15:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-31 11:21 Dithering (off-topic) Michal Kvasnicka
2003-10-31 12:37 ` Bill McClain
2003-11-04 13:34   ` Michal Kvasnicka
2003-11-04 15:48     ` Bill McClain
2003-10-31 15:17 ` Siep Kroonenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).