readImage              package:EBImage              R Documentation

_I_m_a_g_e _I/_O

_D_e_s_c_r_i_p_t_i_o_n:

     Functions to read and write images from/to files and URL's. The
     supported image formats depend on the capabilities of ImageMagick.

_U_s_a_g_e:

       readImage(files, colormode)
       writeImage(x, files, quality = 100)

_A_r_g_u_m_e_n_t_s:

   files: A character vector of file names or URLs. If missing, an
          interactive file chooser is displayed.

       x: An 'Image' object or an array.

 quality: A numeric, ranging from 1 to 100. Default is 100.

colormode: Deprecated.

_D_e_t_a_i_l_s:

     When writing images in formats supporting lossy compression (like
     JPEG), the quality can be specified used a 'quality' value in the
     range '[1,100]'. The best quality is obtained with 100.

     The file format is deduced from the file name extension.

     'ImageMagick' is used to perform all image I/O operations.
     Therefore, the package supports all the file types supported by
     'ImageMagick'.

     When reading images, files of different formats can be mixed in
     any sequence, including mixing single 2D images with TIFF image
     stacks. The result will contain a stack with all images and
     stacks, at the size of the first image read. Subsequent images are
     cropped (if larger) or filled with background (if smaller).

_V_a_l_u_e:

     'readImage' returns a new 'Image' object. 'writeImage' returns
     'invisible(files)'.

_A_u_t_h_o_r(_s):

     Oleg Sklyar, osklyar@ebi.ac.uk, 2005-2006

_R_e_f_e_r_e_n_c_e_s:

     ImageMagick: <URL: http://www.imagemagick.org>

_E_x_a_m_p_l_e_s:

        ## Reads and display images
        f = system.file("images", "lena-color.png", package="EBImage")
        x = readImage(f)
        if (interactive()) display(x)

        x = readImage(system.file("images", "nuclei.tif", package="EBImage"))
        if (interactive()) display(x)
        
        try({
          im = readImage("http://www.google.com/intl/en/images/logo.gif")
          if (interactive()) display(im)
        })

        ## Converts a TIFF file into JPEG
        f1 = system.file("images", "lena-color.png", package="EBImage")
        x1 = readImage(f1)
        f2 = paste(tempfile(), "jpeg", sep=".")
        writeImage(x1, f2)
        cat("Converted '", f1, "' into '", f2, "'.\n", sep='')

