[R] Reading JPG files within R

Roger Bivand Roger.Bivand at nhh.no
Thu Nov 20 19:51:32 CET 2003

On Thu, 6 Nov 2003, Paolo Sirabella wrote:

> Dear R-listers,
> I am an enthusiastic new to R and have the following simple (. I hope .)
> problem:
> I am searching a function that allows to import jpg files as matrices (n
> x m x 3) i.e. n_pixels x m_pixels x 3_colors.
> I have seen the pixmap library, but it seems able only to read BMP
> pictures (and not all them .).

I don't think your question was answered straight away, and maybe you have 
found a solution yourself. Typically, you can convert your JPG to the 
format handled by the pixmap package, PPM, in a graphics utility such as 
ImageMagick on Windows or Unix/Linux, and then use pixmap, which gives you 
an array in its pixmapRGB form.

> Can someone give me some suggestions ? 
> Thank you in advance.
> =========================================
> Paolo Sirabella
> University of Rome "La Sapienza" - Rome - Italy
> Dept. of Human Physiology and Pharmacology
> Biophysiscs Group
> =========================================
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no

More information about the R-help mailing list