天地有情

画像コマンドの使い方

画像コマンドの使い方

W32TeXの[bin]ホルダ下には次のような画像変換コマンド(.exe)が存在します.
どのような機能をもつのかはコマンド名でおおよそわかります.

・bmp2png    bmp → png Converter
・png2bmp    png → bmp Converter
・dvipng     dvi → png Converter
・latex2png   latex source → png Converter
・dvigif     dvi → gif Converter
・png2pdf    png → pdf Converter
・tiff2png    tiff → png Converter
・cjpeg     bmp,gif,ppm → jpg Converter
・djpeg     jpg → bmp,gif,ppm Converter
・jpeg2ps    jpg → ps/eps Converter
・png22pnm    png → ppm Converter
・ps2pdf     ps/eps → pdf Converter
・pstopdf    ps → pdf Converter
・epstopdf    eps → pdf Converter
・ps2eps     ps → eps Converter
・pstops     ps → ps Converter
・bmeps     png,jpg,pnm → eps Converter
・sam2p     gif,jpg,png → ps,pdf Converter

以下はこれらコマンドの一般的な使用法の説明です.

(1)bmp2png   bmp から png への画像変換.

c:\> bmp2png --help
-----------------------------------------------
Usage: bmp2png [-switches] inputfile(s) ...
or: ... | bmp2png [-switches] | ...

List of input files may use wildcards (* and ?)
Output filename is same as input filename, but extension .png

Switches (case-insensitive) :
-0..-9 Compression level (default: -6)
-I Create interlaced PNG files
-F type[,...] Specify filter type(s) used to create PNG files
type: none,sub,up,average(avg),paeth,all,auto(default)
-O name Specify name for output file
-D dir Output files into dir
-E Delete input files after successful conversion
-T Set the timestamp of input file on output file
-Q Quiet mode
-L Log errors to .\B2PERROR.LOG file
-----------------------------------------------
例:
a) bmp2png infile.bmp > outfile.png
b) bmp2png -O infile.bmp outfile.png

(2)png2bmp   png から bmp への画像変換.

c:\> png2bmp --help
-----------------------------------------------
Usage: png2bmp [-switches] inputfile(s) ...
or: ... | png2bmp [-switches] | ...

List of input files may use wildcards (* and ?)
Output filename is same as input filename, but extension .bmp

Switches (case-insensitive) :
-O name Specify name for output file
-D dir Output files into dir
-E Delete input files after successful conversion
-T Set the timestamp of input file on output file
-Q Quiet mode
-L Log errors to .\P2BERROR.LOG file
-----------------------------------------------
例:
a) png2bmp infile.png > outfile.bmp
b) png2bmp -O infile.png outfile.bmp

(3)dvipng   dvi から png への画像変換.
(4)latex2png   latexソース(.tex)から png への画像変換.
(5)dvigif   dvi から gif への画像変換.

使い方は 
PNG画像を生成する2つのコマンドの使い方 ー備忘録ー
http://konoyonohana.blog.fc2.com/をご参照下さい.

(6)png2pdf   png から pdf への画像変換.

c:\> png2pdf --help
-----------------------------------------------
Usage:
png2pdf -h
png2pdf --help

shows this help text.

png2pdf -v
png2pdf --version

shows version information

png2pdf -c
png2pdf --configure

sets permanent options. See below for options you can set

png2pdf -C
png2pdf --show-configuration

shows the current set of permanent options.

png2pdf -u
png2pdf --unconfigure

removes the permanent options.

png2pdf -r
png2pdf --reset

temporarily overrides the permanent options.

Options:
--------
-p
--pdf

specifies the PDF level. Maybe 1.2, 1.3 or 1.4.

-m
--mix-background

mixes against the background contained in the file's background
chunk or against the specified background color if the file
doesn't have a background chunk.

-s
--mix-specified[=bool]

sets the background specified in the -m option to have
higher priority than the background from the file's background chunk.

-i
--image-mask[=bool]

writes an image mask based on the PNG file's alpha channel
if available.

-a
--transparency[=bool]

writes transparency data based on the PNG file's alpha channel
if available.

-l
--invert-levels[=bool]

inverts the decision level for image mask creation. Normally
only pixels having 0 opacity are masked out. This option
masks all pixel having opacity in range 0...254.

-t
--alpha-transparency[=bool]

treats the alpha channel data as transparency. By default the
alpha channel is treated as opacity data.

-f
--file-time-check[=bool]

When running on a directory we do it in make style. A new PDF
file is created only for those PNG files which are newer
than the appropriate PDFs.
-----------------------------------------------
例:
a) png2pdf -c -p 1.4
sets PDF format level to 1.4.
b) png2pdf -m 255,255,255 x.png x.pdf
converts x.png to x.pdf. If x.png has a background chunk the color
from that chunk is used for color mixing, otherwise we mix
against a white background.
c) png2pdf -m 204,204,255 -s x.png x.pdf
converts x.png to x.pdf mixing against a light blue background
regardless whether or not there is a background chunk in the file.


(7)tiff2png    tiff から png への画像変換.

c:\> tiff2png --help
-----------------------------------------------
Usage: tiff2png [-verbose] [-force] [-destdir ] [-compression ]
[-gamma ] [-interlace] [-invert] [-faxpect] [...]

Read each and convert to PNG format (by default, in same directory as
corresponding TIFF). Suffixes will be changed from .tif or .tiff to .png.

-force overwrite existing PNGs if they exist
-destdir create PNGs in destination directory
-compression set the zlib compression level to (0-9)
-gamma write PNGs with specified gamma (e.g., 0.45455)
-interlace write interlaced PNGs
-invert invert grayscale images (swaps black/white)
-faxpect convert fax with 2:1 aspect ratio to square pixels
-----------------------------------------------

例:
a) tiff2png infile.tiff

(8)cjpeg   bmp,gif,ppm から jpg への画像変換.
c:\> cjpeg --help
-----------------------------------------------
usage: cjpeg [switches] [inputfile]
Switches (names may be abbreviated):
-quality N Compression quality (0..100; 5-95 is useful range)
-grayscale Create monochrome JPEG file
-optimize Optimize Huffman table (smaller file, but slow compression)
-progressive Create progressive JPEG file
-targa Input file is Targa format (usually not needed)
Switches for advanced users:
-dct int Use integer DCT method (default)
-dct fast Use fast integer DCT (less accurate)
-dct float Use floating-point DCT method
-restart N Set restart interval in rows, or in blocks with B
-smooth N Smooth dithered input (N=1..100 is strength)
-maxmemory N Maximum memory to use (in kbytes)
-outfile name Specify name for output file
-verbose or -debug Emit debug output
Switches for wizards:
-baseline Force baseline quantization tables
-qtables file Use quantization tables given in file
-qslots N[,...] Set component quantization tables
-sample HxV[,...] Set component sampling factors
-scans file Create multi-scan JPEG per script file
-----------------------------------------------

例:
a) cjpeg xxx.bmp yyy.ppm → xxx.jpg , yyy.jpg を得る.

(9)djpeg     jpeg から bmp,gif,ppm への画像変換.
   
c:\> djpeg --help
-----------------------------------------------
usage: djpeg [switches] [inputfile]
Switches (names may be abbreviated):
-colors N Reduce image to no more than N colors
-fast Fast, low-quality processing
-grayscale Force grayscale output
-scale M/N Scale output image by fraction M/N, eg, 1/8
-bmp Select BMP output format (Windows style)
-gif Select GIF output format
-os2 Select BMP output format (OS/2 style)
-pnm Select PBMPLUS (PPM/PGM) output format (default)
-rle Select Utah RLE output format
-targa Select Targa output format
Switches for advanced users:
-dct int Use integer DCT method (default)
-dct fast Use fast integer DCT (less accurate)
-dct float Use floating-point DCT method
-dither fs Use F-S dithering (default)
-dither none Don't use dithering in quantization
-dither ordered Use ordered dither (medium speed, quality)
-map FILE Map to colors used in named image file
-nosmooth Don't use high-quality upsampling
-onepass Use 1-pass quantization (fast, low quality)
-maxmemory N Maximum memory to use (in kbytes)
-outfile name Specify name for output file
-verbose or -debug Emit debug output
-----------------------------------------------
例:
a) djpeg -colors 256 -bmp infile.jpg > outfile.bmp
JPEGファイル形式から256色のBMPファイルに変換する

(10)jpeg2ps   jpeg から ps,eps への画像変換.

c:\> jpeg2ps --help
-----------------------------------------------
usage: jpeg2ps [options] jpegfile > epsfile
-a auto rotate: produce landscape output if width > height
-b binary mode: output 8 bit data (default: 7 bit with ASCII85)
-h hex mode: output 7 bit data in ASCIIHex encoding
-o output file name
-p page size name. Known names are:
a0, a1, a2, a3, a4, a5, a6, b5, letter, legal, ledger, p11x17
-q quiet mode: suppress all informational messages
-r resolution value (dots per inch)
0 means use value given in file, if any (disables autorotate)
-----------------------------------------------
例:
a) jpeg2ps infile.jpg > outfile.eps
b) jpeg2ps infile.jpg > outfile.ps

(11)png22pnm   png から ppm への画像変換.

c:\> png22pnm --help
-----------------------------------------------
usage: [-verbose] [-alpha | -mix | -rgba] [-background color] ...
... [-gamma value] [-text file] [-time] [pngfile]
-----------------------------------------------
例:
a) png22pnm infile.png > outfile.ppm
  ※ .ppm画像表示は IrfanView を利用するとよい.

(12)ps2pdf   ps/eps から pdf への画像変換.

c:\> ps2pdf --help
-----------------------------------------------
Usage: ps2pdf input.ps [output.pdf]
or: ps2pdf [options...] input.[e]ps output.pdf

option:
-sPAPERSIZE=(a4など)
-dEPSCrop
-dPDFA
-sProcessColorModel#DeviceCMYK
-----------------------------------------------
例:
a) ps2pdf infile.ps
b) ps2pdf infile.ps outfile.pdf
c) ps2pdf infile.eps outfile.pdf
d) ps2pdf infile.(e)ps > outfile.pdf

(13)pstopdf   ps/eps から pdf への画像変換.

c:\> pstopdf --help
-----------------------------------------------
PsToPdf | --convert convert ps into pdf
PsToPdf | --request handles exa request file
PsToPdf | --watch watch folders for conversions (untested)
-----------------------------------------------
例:
a) pstopdf infile.ps
※ Ghostscriptの最新version(9.10)が不整合のようでエラーになりました.

(14)epstopdf    eps から pdf への画像変換.

c:\> epstopdf --help
-----------------------------------------------
Usage: epstopdf [OPTION]... [EPSFILE]

Convert EPS to PDF, by default using Ghostscript.

Options:
--help display this help and exit
--version display version information and exit

--outfile=FILE write result to FILE
--(no)compress use compression (default: true)
--(no)debug write debugging info (default: false)
--(no)embed embed fonts (default: true)
--(no)exact scan ExactBoundingBox (default: false)
--(no)filter read standard input (default: false)
--(no)gs run ghostscript (default: true)
--(no)hires scan HiResBoundingBox (default: false)
--gscmd=VAL pipe output to VAL (default: gswin32c)
--res=DPI set image resolution (default: [use gs default])
--autorotate=VAL set AutoRotatePages (default: None)
Recognized VAL choices: None, All, PageByPage;
for EPS files, PageByPage is equivalent to All.
--restricted use restricted mode (default: false)

例:
all equivalently producing test.pdf:
a) epstopdf test.eps
b) cat test.eps | epstopdf --filter >test.pdf
c) cat test.eps | epstopdf -f -o=test.pdf

Example to look for HiResBoundingBox and produce corrected PostScript:
* epstopdf -d --nogs --hires test.ps >testcorr.ps
-----------------------------------------------

(15)ps2eps   ps から eps への画像変換.

c:\> ps2eps --help
-----------------------------------------------
ps2eps [-f] [-q] [-N] [-O] [-n] [-P] [-c] [-b] [-C] [-m] [-B] [-E] [-s ]
[-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-a] [-W] [-L] [-V
|--version] [--] [psfile1] [psfile2] [...]
Options:
-f, --force force overwriting existing files
-q, --quiet quiet operation (no output while processing files)
-N, --noinsert do not insert any postscript code
-O, --preserveorientation do not filter Orientation: header comment
-n, --nofix do not try to fix postscript code
-P, --removepreview remove preview image (smaller file, but no preview)
-F, --fixps fix postscript code unconditionally
-c, --comments preserve document structure comments
-b, --binary treat postscript as binary, do not modify characters

-C, --clip insert postscript code for clipping
-m, --mono use black/white bitmap as base for calculation
-s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm),
where X and Y are numbers
use --size=list to list pre-defined page sizes
-R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees
-t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)
-r, --resolution specify dpi resolution to render with ghostscript (default 144)
-l, --loose expand the original bounding box by one point in each direction
-B, --ignoreBB do not use existing bounding box as page size for rendering
-E, --ignoreEOF do not use %%EOF as hint for end of file
-g, --gsbbox use internal bbox device of ghostscript
-H, --no-hires do not use a HiResBoundingBox
-h, --help help information
-L, --license show licensing information
-V, --version show version information
-d, --debuggs show ghostscript call
-a, --accuracy improve accuracy during rendering (maybe slower)
-W, --warnings show warnings about sanity of generated eps file
-- all following arguments are treated as files
(allows filenames starting with -)
-----------------------------------------------
例:
a) ps2eps infile.ps > outfile.eps
b) ps2eps *.ps

(16)pstops   ps から eps への画像変換.

c:\> pstops
-----------------------------------------------
Usage: pstops [-q] [-b] [-wwidth] [-hheight] [-dlwidth] [-ppaper]
[infile [outfile]]
-----------------------------------------------
例:
a) pstops infile.ps > outfile.ps
b) pstops infile.ps outfile.ps
※ Ghostscriptの最新version(9.10)が不整合のようでエラーになりました.

(17)bmeps   png,jpg,pnm から eps への画像変換.

c:\> bmeps --help
-----------------------------------------------
bmeps [options] [ [ ] ]

Options
-------
-p select one of the following
1 (PS level 1)
2 (PS level 2 = default)
3 (PS level 3)
-b BoundingBox file only
-c turns color printing on
-g turns color printing off (default)

-e combine the follogin characters to specifiy
8 ASCII-85-encoding instead of ASCII-Hex
r runlength encoding
f flate encoding

-t choose one of the following
png
jpg
pnm

-d draft mode only
Draft mode means the program reads only header information
from the bitmap file and prints a dummy image.

-a
o alpha channel is opacity, not transparency
t alpha channel is transparency, not opacity
l alternated transparency trigger level
m mix foreground- and background color
sd,d,d specify background color i.e. s128,128,255
PNG supports transparency channels, having values from
0 ... 2^n-1. EPS supports simple yes/no decisions to mask
pixels, so the alpha channels value must be mapped to
"use pixel" or "mask pixel". The standard behaviour is
to mask only pixels which have no opacity at all.
The alternated trigger level uses only pixels having full
opacity.

-s print DSC comments

-o use showpage operator

-u undefine /pstr and /inputf, use
separated dictionary

-r force garbage collection via "1 vmreclaim"

-q use resolution information from the PNG file's
pHYs chunk (if available).
-----------------------------------------------
例:
a) bmeps -t png infile.png > outfile.eps
b) bmeps -t jpg infile.jpg outfile.eps
c) bmeps -c -t jpg infile.jpg outfile.eps

(18)sam2p   gif,jpg,png から ps,eps への画像変換.


使い方は 
画像変換ツール sam2p 覚え書き
http://konoyonohana.blog.fc2.com/blog-entry-26.htmlをご参照下さい.





スポンサーサイト
  1. 2013/09/17(火) 07:17:08|
  2. 便利ツール
  3. | トラックバック:0
  4. | コメント:0
<<[LaTeX] dvi2dvi コマンドの使い方 | ホーム | PNG画像を生成する2つのコマンドの使い方 ー備忘録ー>>

コメント

コメントの投稿


管理者にだけ表示を許可する

トラックバック

トラックバック URL
http://konoyonohana.blog.fc2.com/tb.php/40-41a7a3ab
この記事にトラックバックする(FC2ブログユーザー)