is.image {quickcode} | R Documentation |
Is file name extension(s) an image
Description
Check if one or multiple file name entry is an image
Usage
is.image(x)
Arguments
x |
vector entry |
Details
This current function tests if the extension of the file name provided belongs to any of the image extensions listed below
AI - Adobe Illustrator
BMP - Bitmap Image
CDR - Corel Draw Picture
CGM - Computer Graphics Metafile
CR2 - Canon Raw Version 2
CRW - Canon Raw
CUR - Cursor Image
DNG - Digital Negative
EPS - Encapsulated PostScript
FPX - FlashPix
GIF - Graphics Interchange Format
HEIC - High-Efficiency Image File Format
HEIF - High-Efficiency Image File Format
ICO - Icon Image
IMG - GEM Raster Graphics
JFIF - JPEG File Interchange Format
JPEG - Joint Photographic Experts Group
JPG - Joint Photographic Experts Group
MAC - MacPaint Image
NEF - Nikon Electronic Format
ORF - Olympus Raw Format
PCD - Photo CD
PCX - Paintbrush Bitmap Image
PNG - Portable Network Graphics
PSD - Adobe Photoshop Document
SR2 - Sony Raw Version 2
SVG - Scalable Vector Graphics
TIF - Tagged Image File
TIFF - Tagged Image File Format
WebP - Web Picture Format
WMF - Windows Metafile
WPG - WordPerfect Graphics
Value
a boolean value to indicate if entry is an image
Examples
img.1 <- "fjk.jpg"
is.image(img.1)
img.0 <- "fjk.bbVG"
is.image(img.0)
img.2 <- "fjk.bmp"
is.image(img.2)
img.3 <- "fjk.SVG"
is.image(img.3)
# a vector of file names
v <- c("logo.png", "business process.pdf",
"front_cover.jpg", "intro.docx",
"financial_future.doc", "2022 buybacks.xlsx")
is.image(v)
# when the file name has no extension
# the function returns NA
v2 <- c("img2.jpg","northbound.xlsx","landimg",NA)
is.image(v2)