'Creating Tiff file in R that opens in Photoshop 2022

How can I create a TIFF image file in R that can be opened by Photoshop?

Previously, I used the following code to create TIFF files that readily opened by an old version of Photoshop (5.x). However, the same files do not open in the new version of Photoshop (23.0.0 20211013.r.36 623993d x64). It returns an error message:

could not complete your request because it is not the right kind of document

Other file formats (JPEG, PDF) created in R, using similar code, open readily in this version of Photoshop. The files are not corrupted as they can be opened in Window's "Photos".

Code:

x <- 1:10
y <- 1:10
gdata <- data.frame(x,y)

library(ggplot2)
ggplot(aes(x, y), data = gdata) + geom_point()

ggsave("GraphTest.tiff", units="cm", width=17, height=21, dpi=300, compression = 'lzw')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source