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, 8 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, AdhereR, CATkit, DIscBIO, EpiReport, Fgmutils, HiveR, ICtest, IDSL.IPA, IFC, Jdmbs, MtreeRing, OpenImageR, PWFSLSmoke, RBitmoji, RMThreshold, RPPASPACE, RXKCD, RclusTool, RevGadgets, RgoogleMaps, Rsgf, SAFARI, SIPDIBGE, SOFIA, Seurat, StereoMorph, Thermimage, Umatrix, animalEKF, bittermelon, bwimage, cartography, ceramic, classifierplots, cmsafvis, colordistance, colorfindr, colourlovers, countcolors, dadjokeapi, details, distill, dplR, dynaSpec, expDB, fDMA, fastai, gMOIP, geoviz, gexp, ggimg, ggmap, ggrastr, ggsn, ggwordcloud, grImport2, gridpattern, gridtext, grobblR, handwriter, iCellR, imager, imguR, iplots, kgschart, latticeExtra, leafem, leaflet, loa, mapboxapi, mapscanner, maptiles, mapview, materialmodifier, measuRing, memery, monographaR, nasadata, netSEM, nomnoml, paleotree, pangaear, patternplot, pid, piecepackr, plainview, polaroid, qgraph, qrencoder, quadmesh, rasterize, rasterpdf, rayimage, rayrender, rayshader, rayvertex, rcdk, readbitmap, recolorize, remoter, reticulate, retistruct, rosm, rphylopic, rsyntax, showimage, simulariatools, sketcher, skyscapeR, slippymath, spacey, spork, starsTileServer, tableHTML, terrainr, tidyMicro, tikzDevice, tiler, torchvision, trackdem, ursa, wal, x3ptools, xgxr, zooimage.

Depended on by GiNA, orloca.

Suggested by Cairo, Census2016, DCG, DatabionicSwarm, EGRET, GeneralizedUmatrix, MODIStsp, MTA, MultiFit, ProjectionBasedClustering, RGraphics, RImageJROI, RImagePalette, SpaDES.core, TeachingDemos, altair, aplpack, aroma.core, baRulho, basemaps, behaviorchange, bfw, boxr, bp, brickr, canvasXpress, chess, ciftiTools, circlize, colorBlindness, colorspace, dtwSat, egg, exams, featurefinder, ggdist, ggmulti, glmmTMB, httr, imgpalr, inlmisc, insee, knitr, lavaanPlot, lcars, loon, loon.ggplot, loon.shiny, mapSpain, mapsf, mazing, milorGWAS, multiverse, nosoi, nprcgenekeepr, nvctr, patchwork, pdftools, plot.matrix, plotly, quantdr, rbioapi, retroharmonize, rgbif, rgee, rtrek, scifigure, sensemakr, spinifex, spiralize, splashr, spup, superb, tabr, tidybayes, tmap, tmaptools, trackr, tvthemes, vegawidget, warbleR, webp, wiad.

Enhanced by CVD, base64enc, colorscience.

See at CRAN