IFF_PNG: File Format Symbolic Constants

IFF_PNGR Documentation

File Format Symbolic Constants

Description

pixWrite creates a file containing the image in the Pix. The code uses the leptonica library and, depending on how it was installed, it has support for numerous image formats.

The IFF (ImageFileFormat) variables are symbolic constants used to identify different image file formats. We use them in pixWrite to indicate the desired file format for the image being written. These are better than strings, e.g. "PNG", or simple numbers, e.g. 3. However, one can use either of these forms also. However, IFF_PNG is preferred to "PNG" and both are much preferred to 3.

Usage

pixWrite(pix, file, format = guessImageFormatByExt(file)) 

Arguments

pix

the Pix object containing the imagex

file

the name of the file to which the image will be written.

format

the file format to use. By default, we attempt to guess the format from the extension on the file name. However, one can specify it using the IFF_ variables, e.g. IFF_PNG, or by a string corresponding to the suffix of one of these IFF varibles, e.g. "PNG" or "png". We discourage using the integer values of these IFF_ variables. The code is less readable and these values may change in the future, but not the symbolic names.

Source

Leptonica imageio.h heade file.

References

http://www.leptonica.com

See Also

pixWrite

Examples

## Not run: 
  f = system.file("images", "DifferentFonts.png", package = "Rtesseract")
  p = pixRead(f)
  pixWrite(p, "foo.webp", IFF_WEBP)
  pixWrite(p, "foo.tiff", IFF_TIFF_LZW)
  pixWrite(p, "foo.webp", "WEBP")
  pixWrite(p, "foo.tiff", "TIFF_LZW")

  pixWrite(p, "foo.webp")

## End(Not run)

duncantl/Rtesseract documentation built on March 25, 2022, 5:50 a.m.