Yolinux.com

pngtopam manpage

Search topic Section


Pngtopam User Manual(0)				       Pngtopam User Manual(0)



NAME
       pngtopam - convert a PNG image into a Netpbm image


SYNOPSIS
       pngtopam	 [-verbose]  [-alphapam	 |  -alpha | -mix] [-background=color]
       [-gamma=value] [-text=filename] [-time] [pngfile]

       Minimum unique abbreviation of option is acceptable.  You may use  dou-
       ble  hyphens  instead  of single hyphen to denote options.  You may use
       white space in place of the equals sign to separate an option name from
       its value.


DESCRIPTION
       This program is part of Netpbm(1).

       pngtopam	 reads	a  PNG	image (Portable Network Graphics) as input and
       produces a Netpbm image as output.  The type of the output file depends
       on the input file - if it's black & white, pngtopam creates a PBM file.
       If it's grayscale, pngtopam creates a PGM file.	Otherwise, it  creates
       a PPM file.  Except that with the -alphapam option, it always creates a
       PAM file.  That	file  has  tuple  type	GRAYSCALE_ALPHA	 or  RGB_ALPHA
       depending on whether the input has color or not.


OPTIONS
       -verbose
	      Display  various	information  about the input PNG image and the
	      conversion process.

	      If you want even more  information  about	 the  PNG  image,  use
	      pngcheck (not part of Netpbm).


       -alphapam
	      Produce  a  single output image containing the main image (fore-
	      ground) and the alpha channel or transparency mask.  This	 image
	      is  in  the PAM format with tuple type of either GRAYSCALE_ALPHA
	      (which has a depth of 2 channels)	 or  RGB_ALPHA	(which	has  a
	      depth of 4 channels).

	      You  can	specify only one of -alphapam, -alpha, and -mix.  With
	      none of them, pngtopam produces an image of  the	foreground  of
	      the input image and discards transparency information.

	      This option was new in Netpbm 10.44 (September 2008).


       -alpha Output  the alpha channel or transparency mask of the image. The
	      result is either a PBM file or a PGM file, depending on  whether
	      different levels of transparency appear.

	      pngtopam discards the main image (the foreground).

	      You  can	specify only one of -alphapam, -alpha, and -mix.  With
	      none of them, pngtopam produces an image of  the	foreground  of
	      the input image and discards transparency information.


       -mix   Compose  the image with the transparency or alpha mask against a
	      background.  The background color	 is  determined	 by  the  bKGD
	      chunk  in	 the  PNG, except that you can override it with -back-
	      ground.  If the PNG has no bKGD  chunk  and  you	don't  specify
	      -background, the background color is white.

	      You  can	specify only one of -alphapam, -alpha, and -mix.  With
	      none of them, pngtopam produces an image of  the	foreground  of
	      the input image and discards transparency information.


       -background=color
	      This option specifies the background color with which to mix the
	      image when you specify -mix.

	      color is as described for the argument of	 the  ppm_parsecolor()
	      library routine <libppm.html#colorname> .

	      Examples:



       o      -background=rgb:01/ff/80

       o      -background=rgbi:1/255/128


	      If  you  don't specify -background, the background color is what
	      is specified in the PNG image, and if the	 PNG  doesn't  specify
	      anything, white.

	      You  cannot  specify  -background	 unless you also specify -mix.
	      Before Netpbm 10.27 (March 2005), you could specify  -background
	      without  -mix and it was just ignored.  (This caused a usability
	      problem).



       -gamma=value
	      Converts the image to a new  display-gamma  value.   If  a  gAMA
	      chunk  is	 present  in the png-file, pngtopam uses the specified
	      image-gamma value.  If not, pngtopam considers  the  image-gamma
	      to be 1.0.  Based on the image-gamma and the display-gamma given
	      with this option, pngtopam adjusts the  colors  written  to  the
	      pnm-file.

	      Because  the  gammas  of	uncompensated monitors are around 2.6,
	      which results in an image-gamma of 0.45, some typical situations
	      are:  when  the  image-gamma is 0.45 (use -verbose to check) and
	      the picture is too light, your  system  is  gamma-corrected,  so
	      convert with '-gamma 1.0'.  When no gAMA chunk is present or the
	      image-gamma is 1.0, use 2.2 to make the picture lighter and 0.45
	      to make the picture darker.

	      One  oddity  to  be  aware of when using -gamma on an image with
	      transparency: The PNG image specifies that a  certain  color  is
	      transparent,  i.e.  every	 pixel	in  the image of that color is
	      transparent.  But pngtopam interprets this as  applying  to  the
	      gamma-corrected  space,  and there may be less precision in that
	      space than in the original,  which  means	 multiple  uncorrected
	      colors  map  to  the  same corrected color.  So imagine that the
	      image contains 3 shades of white and specifies that one of  them
	      is  transparent.	After gamma correction, those three shades are
	      indistinguishable, so pngtopam considers	pixels	of  all	 three
	      shades to be transparent.

	      If  this	is  not	 what you want, don't use gamma.  Instead, use
	      pnmgamma on the output.



       -text=file
	      Writes the tEXt and zTXt chunks  to  a  file,  in	 a  format  as
	      described	 in  the  pnmtopng  user manual.  These chunks contain
	      text comments or annotations.


       -time  Prints the tIME chunk to stderr.




SEE ALSO
       pnmtopng(1), pnmtopng(1), ptot, pnmgamma(1), pnm(1)

       For  information	 on  the   PNG	 format,   see	 http://schaik.com/png
       <http://schaik.com/png> .


NOTE
       A  PNG image contains a lot of information that can't be represented in
       Netpbm formats.	Therefore, you lose information when  you  convert  to
       another	format	with "pngtopam | pnmtoxxx".  If there is a specialized
       converter that converts directly to the other format, e.g. ptot to con-
       vert from PNG to TIFF, you'll get better results using that.


LIMITATIONS
       There  could  be	 an option to include PNG comment chunks in the output
       image as PNM comments instead of putting them in a separate file.

       The program could be much faster, with a bit of	code  optimizing.   As
       with  any  Netpbm  program,  speed  always  takes  a back seat to quick
       present and future development.


HISTORY
       pngtopam was new in Netpbm 10.44, as a replacement for  pngtopnm.   The
       main  improvement  over pngtopnm was that it could generate a PAM image
       with a transparency channel, whereas with pngtopnm, you would  have  to
       extrac the transparency channel as a separate file, in a separate run.

       pngtopnm	 was  new  in Netpbm 8.1 (March 2000), the first big change to
       the package in Netpbm's	renaissance.   It  and	pnmtopng  were	simply
       copied  from  the    pnmtopng  package (1) by Greg Roelofs.  Those were
       based  on  simpler  reference  applications  by	by  Alexander  Lehmann
       <alex@hal.rhein-main.de>	 and Willem van Schaik <willem@schaik.com> and
       distributed with their PNG library.

       Nearly all of the code has changed since it was copied  from  the  pnm-
       topng package, most of it just to improve maintainability.



AUTHORS
       Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.



netpbm documentation		 22 July 2008	       Pngtopam User Manual(0)