Read and write PNG images

This package provides an easy and simple way to read, write and display bitmap images stored in the PNG format. It can read and write both files and in-memory raw vectors.



0.1-7 2013-12-03 o fix endianness issue in writePNG() on big-endian machines when using nativeRaster

0.1-6 2013-07-02 o add support for text tags as well as R object metadata which is serialized into the text field (Thanks to Duncan Temple Lang for the idea)

0.1-5 2013-06-03 o add dpi and asp to writePNG() which allows to store the image resolution or aspect ratio (via the sPHYs PNG tag).

o	add info flag to readPNG() which interprets some optional
tags to return additional information such as dpi, asp
or gamma if stored.

o	try to detect local libpng via LOCAL_SOFT on Windows.
Note that if you use LOCAL_SOFT, you are taking full
responsibility over the libraries that png will be linked

0.1-4 2011-12-10 o writePNG() now supports binary connection as target and the default target is now raw()

0.1-3 2011-09-02 o remove debugging output

o	added a missing call to png_set_interlace_handling to allow
libpng to de-interlace images

o	prevent warnings in readPNG() example for the windows device
which is incapable of any transparency

0.1-2 2011-01-19 o support raw array as input to writePNG (RGBA only)

o	do not truncate 16-bit images in readPNG() if the resulting
output is not nativeRaster

o	Windows binary on RForge has been updated to libpng 1.5.0

0.1-1 2010-04-06 o add tolerance to writePNG() to avoid shifts by one in color because of numerical representation of discretized values

o	adapt to a last-minute change in R 2.11.0 from raster() to

o	add support for more efficient nativeRaster format

0.1-0 2010-03-17 o first release on CRAN, supports readPNG() and writePNG() for files and raw vectors. readPNG() supports any input color type but will convert to 1-4 planes with 8-bit accuracy each. writePNG() will write out 1-4 planes 8-bit each. writePNG() has currenty no provision for generating or stroring a palette.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1-7 by Simon Urbanek, 5 years ago

Browse source code at

Authors: Simon Urbanek <[email protected]>

Documentation:   PDF Manual  

GPL-2 | GPL-3 license

System requirements: libpng

Imported by AFM, BayesBD, CATkit, CRPClustering, EpiReport, Fgmutils, HiveR, ICtest, Jdmbs, MtreeRing, OpenImageR, PWFSLSmoke, RBitmoji, RMThreshold, RXKCD, RgoogleMaps, Rgretl, SOFIA, Seurat, StereoMorph, Thermimage, Umatrix, classifierplots, colordistance, colorfindr, countcolors, d3heatmap, dplR, fDMA, geoviz, ggmap, ggsn, ggwordcloud, grImport2, icesSAG, imager, imguR, iplots, kgschart, leaflet, lessR, loa, mapview, measuRing, memery, monographaR, nasadata, netSEM, neuropsychology, pangaear, patternplot, pid, plainview, qgraph, qrencoder, quadmesh, radix, rasterize, rayshader, rcdk, readbitmap, remoter, retistruct, rosm, rphylopic, showimage, skyscapeR, slippymath, tableHTML, tabulizer, tikzDevice, tiler, trackdem, x3ptools, zooimage.

Depended on by GiNA, IM, gexp, orloca.

Suggested by Cairo, Census2016, DCG, DatabionicSwarm, GeneralizedUmatrix, MODIStsp, MTA, MultiFit, ProjectionBasedClustering, RGraphics, RImageJROI, RImagePalette, SpaDES.core, TeachingDemos, aplpack, aroma.core, bfw, canvasXpress, circlize, colorspace, customLayout, dtwSat, egg, exams, featurefinder, gganimate, glmmTMB, httr, knitr, loon, nvctr, pdftools, plotly, rgbif, rsvg, rvest, scifigure, spinifex, splashr, spup, tidybayes, tmap, tmaptools, trackr, vegawidget, webp.

Enhanced by CVD, Rgnuplot, base64enc, colorscience.

See at CRAN