Skip to contents

Check if one or multiple file name entry is not an image

Usage

not.image(x)

Arguments

x

vector entry

Value

a boolean value to indicate if entry is not an image

Details

This current function tests if the extension of the file name provided does NOT 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

Examples

img.1 <- "fjk.jpg"
not.image(img.1)
#> [1] FALSE

img.2 <- "fjk.bmp"
not.image(img.2)
#> [1] FALSE

img.3 <- "fjk.SVG"
not.image(img.3)
#> [1] FALSE

# a vector of file names
v <- c("logo.png", "business process.pdf",
"front_cover.jpg", "intro.docx",
"financial_future.doc", "2022 buybacks.xlsx")
not.image(v)
#> [1] FALSE  TRUE FALSE  TRUE  TRUE  TRUE

# when the file name has no extension
# the function returns NA
v2 <- c("img2.jpg",NA,"northbound.xlsx","landimg")
not.image(v2)
#> [1] FALSE    NA  TRUE    NA