ifcb_zip_images_by_class: Zip Image Subfolders by Class

View source: R/ifcb_zip_images_by_class.R

ifcb_zip_images_by_classR Documentation

Zip Image Subfolders by Class

Description

This function creates one zip archive per immediate subdirectory in a folder containing image files. Each archive corresponds to a single class or taxon.

Usage

ifcb_zip_images_by_class(
  image_folder,
  output_dir,
  n_images = NULL,
  quiet = FALSE
)

Arguments

image_folder

The directory containing subdirectories with image files.

output_dir

The directory where the zip archives will be written.

n_images

Integer. Maximum number of images to randomly sample per subdirectory. If NULL, all images are included.

quiet

Logical. If TRUE, suppresses the progress bar. Default is FALSE.

Details

When n_images is specified, images are randomly sampled without replacement from each subdirectory. When n_images is NULL, all images in each subdirectory are included.

Supported image formats (case-insensitive) are: png, jpg, jpeg, tif, tiff, bmp, and gif.

Value

This function does not return any value; it creates one zip archive per subdirectory containing images.

Examples

## Not run: 
# Set a random seed to reproduce the random sampling
set.seed(123)

# Create zip archives for each subdirectory with up to 50 random images
ifcb_zip_images_by_class(
  image_folder = "path/to/images",
  output_dir = "path/to/zips",
  n_images = 50
)

## End(Not run)

iRfcb documentation built on Jan. 8, 2026, 1:06 a.m.