Mark Heckmann
2012-May-13 10:57 UTC
[R] determine size (width and height) of a graphics file via R - how?
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120513/4aaf35d4/attachment.pl>
Ethan Brown
2012-May-14 21:21 UTC
[R] determine size (width and height) of a graphics file via R - how?
Hi Mark, You can do this easily with the "identify" command in ImageMagick <http://www.imagemagick.org>. Install it, and then from within an R session: system2("identify", "yourimagename.jpg") ...and it should give you something like this: yourimagename.jpg JPEG 800x533 800x533+0+0 8-bit DirectClass 378KB 0.000u 0:00.019 ...which is overkill but does include the dimensions. If you're on Windows you need an extra argument: system2("identify", "yourimagename.jpg", invisible = FALSE) to make sure it actually shows you the result. EBImage is an R interface to imagemagick but is probably more trouble than it's worth for the simple task you're trying to do. Hope this helps, Ethan On Sun, May 13, 2012 at 6:57 AM, Mark Heckmann <mark.heckmann at gmx.de> wrote:> Hi, > > is there a way to determine the size (width, height) of a graphics file saved on my hard disk, e.g. a .bmp, via R. > What I want is basically the same information on the dimensions of the graphic file that I get from my file browser. > > Thanks > Mark > > PS. Why: I use the R2PPT and I need to determine the size of the original graphic before adding it to a slide. > > ?????????????????? > Mark Heckmann > Blog: www.markheckmann.de > R-Blog: http://ryouready.wordpress.com > > > > > > > > > > > > ? ? ? ?[[alternative HTML version deleted]] > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >