stretch_images: Stretch images to the maximum width and height of two images

View source: R/stretch_images.R

stretch_imagesR Documentation

Stretch images to the maximum width and height of two images

Description

This stretches the images to the maximum width and height of two images.

Usage

stretch_images(image_1, image_2)

Arguments

image_1

The first image of the pair of images for which the comparison must be made.

image_2

The second image of the pair of images for which the comparison must be made.

Value

image_1

The first image stretched to the maximum width and height of the two images being compared

image_2

The second image stretched to the maximum width and height of the two images being compared

Note

This is part of a suite of functions required to compare images.

Author(s)

Kurinchi Gurusamy

References

https://sites.google.com/view/equal-group/home

See Also

compare_similarities_two_images()

Examples

# Create a plot and save this as file - width less than height
filename_1 <- tempfile(fileext = ".png")
png(filename_1, width = 300, height = 450, units = "px")
plot.new()
hist(rnorm(100))
recordPlot()
dev.off()
# One more plot for comparison - width more than height
filename_2 <- tempfile(fileext = ".png")
png(filename_2, width = 450, height = 300, units = "px")
plot.new()
boxplot(rnorm(100))
recordPlot()
dev.off()

# Read images
library(magick)
image_1 <- image_read(filename_1)
image_2 <- image_read(filename_2)

# Perform the function
results <- stretch_images(image_1 = image_1, image_2 = image_2)
# Plots are stretched to the maximum height and maximum width among the two images
plot(results[[1]])
plot(results[[2]])

EQUALCompareImages documentation built on Sept. 9, 2025, 5:35 p.m.