[R] PNG-import into R

Tuszynski, Jaroslaw W. JAROSLAW.W.TUSZYNSKI at saic.com
Mon Nov 21 15:38:59 CET 2005


I was looking once for all supported image formats, here is what I found:

Format | read file to matrix | write matrix to file | write plot to file
-------|---------------------|----------------------|-------------------
PNG    |                     |                      | png,  bitmap, GDD
JPEG   | read.jpeg           |                      | jpeg, bitmap, GDD
GIF    | read.gif            | write.gif            | GDD
TIFF   | read.picture        | write.picture        | savetiff, bitmap
PDF    |                     |                      | pdf, bitmap
ENVI   | read.ENVI           | write.ENVI           |
?      | read.pnm            | write.pnm            |
	   
I have not played with every one of those functions and I think that every
read/write returns "matrix" in some other internal format. Also, last 2
formats are rather exotic and of limited use. Use CRAN search to look up
package of each function.

So I think that in your case your best bet would be to convert your file to
GIF (if you can live with only 256 colors) or TIFF.

Also does anybody know how hard would it be to tap into C code needed for
'read.jpeg', 'png' and 'jpeg' functions to write 'read.png' , 'write.png',
and 'write.jpeg' functions?

Jarek Tuszynski

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Sydler, Dominik
Sent: Monday, November 21, 2005 5:36 AM
To: r-help at stat.math.ethz.ch
Subject: [R] PNG-import into R

Hi there

I'm looking for a function to read PNG-bitmap-images from a file into R.
I only found:
 - the pixmap-package which cannot import png or similar formats
 - the rimage-package which can only import lossy jpeg-images (the
convertion from png to jpeg modifies the data!)

Is there any possibility to read PNG-files?

Thanks for any help
         Dominic Sydler

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list