Image Demosaicking with Contour Stencils
|
Postscript level-2.0 file writing. More...
#include "psio.h"
Go to the source code of this file.
Macros | |
#define | FILE_BUFFER_CAPACITY (1024*4) |
Buffer size to use for PS file I/O. More... | |
Functions | |
FILE * | PsOpen (const char *FileName, int XMin, int YMin, int XMax, int YMax) |
Start writing a new PS level-2 file. More... | |
int | PsClose (FILE *File) |
Finish writing a PS file. More... | |
int | PsSetDistillerParams (FILE *File, const char *Params) |
Set distiller parameters for PDF conversion. More... | |
int | PsWriteGrayImage (FILE *File, const uint8_t *Image, int Width, int Height) |
Writes a grayscale image to a PS file. More... | |
int | PsWriteColorImage (FILE *File, const uint8_t *Image, int Width, int Height) |
Writes an RGB color image to a PS file. More... | |
Postscript level-2.0 file writing.
Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.
This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.
Definition in file psio.c.
#define FILE_BUFFER_CAPACITY (1024*4) |
int PsClose | ( | FILE * | File | ) |
FILE* PsOpen | ( | const char * | FileName, |
int | XMin, | ||
int | YMin, | ||
int | XMax, | ||
int | YMax | ||
) |
Start writing a new PS level-2 file.
FileName | the PS file name |
XMin,YMin,XMax,YMax | the viewport |
Creates file FileName and writes a PS level 2 header with bounding box (0, 0, XMax-Xmin, YMax-YMin). The canvas is translated if XMin or YMin is nonzero.
Definition at line 32 of file psio.c.
int PsSetDistillerParams | ( | FILE * | File, |
const char * | Params | ||
) |
Set distiller parameters for PDF conversion.
File | the stdio file handle |
Param | distiller parameters string |
If the PS file is converted to PDF, the distiller parameters can be used for example to specifiy the image compression. The parameters
"/AutoFilterColorImages false /ColorImageFilter /FlateEncode"
instruct that color images are to be losslessly compressed with deflate. That is, the color image data in the PS will be preserved exactly in the conversion to PDF. The analogous parameters for grayscale images are
"/AutoFilterGrayImages false /GrayImageFilter /FlateEncode"
Alternatively, the quality with lossy DCT compression can be controlled as
"/ColorACSImageDict << /QFactor 0.15 /Blend 1 /ColorTransform 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >>"
where a smaller quantization factor ("QFactor") implies higher quality and larger file size. The QFactor value 0.15 above is equivalent to "Maximum Quality" in Adobe Distiller.
This function should be called immediately after PsOpen.
Definition at line 110 of file psio.c.
int PsWriteColorImage | ( | FILE * | File, |
const uint8_t * | Image, | ||
int | Width, | ||
int | Height | ||
) |
Writes an RGB color image to a PS file.
File | the stdio file handle to write to |
Image | interleaved RGB color image data |
Width,Height | the image dimensions |
The image is plotted on the canvas in the rectangle [0,Width] x [0,Height] where the lower-left corner is at the origin. This routine only writes the image data. PsOpen should be called first, then this routine and other drawing commands, and finally PsClose. If the PS file will be converted to PDF, use PsSetDistillerParams to control how the image will be recompressed.
For relative simplicity, the image data is written uncompressed in ASCII85 encoding. The file size is approximately 25% larger than in the PPM file format.
Definition at line 260 of file psio.c.
int PsWriteGrayImage | ( | FILE * | File, |
const uint8_t * | Image, | ||
int | Width, | ||
int | Height | ||
) |
Writes a grayscale image to a PS file.
File | the PS file handle to write to |
Image | grayscale image data |
Width,Height | the image dimensions |
The image is plotted on the canvas in the rectangle [0,Width] x [0,Height] where the lower-left corner is at the origin. This routine only writes the image data. PsOpen should be called first, then this routine and other drawing commands, and finally PsClose. If the PS file will be converted to PDF, use PsSetDistillerParams to control how the image will be recompressed.
For relative simplicity, the image data is written uncompressed in ASCII85 encoding. The file size is approximately 25% larger than in the PGM file format.