[Rd] Is this surprising behavior of tkimage.create function a bug?

オチショウタ @hot@och|1990 @end|ng |rom gm@||@com
Thu Jul 9 22:21:06 CEST 2020


tkimage.create function can read some images but can't read the other
images.
We can reproduce it by running the code below.
-------------------------------------------------------------------------------------
library(tcltk)
library(magick)

# works fine
tmp <- tempfile(fileext = ".gif")
image_write(logo, tmp)
image_tcl <- tkimage.create("photo", "image_tcl", file = tmp)

# doesn't work fine
logo2 <- image_convert(logo, format = "jpeg")
tmp2 <- tempfile(fileext = ".jpg")
image_write(logo2, tmp2)
image_tcl <- tkimage.create("photo", "image_tcl2", file = tmp2)
------------------------------------------------------------------------------------

The last line returns an error below.
> Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
  [tcl] couldn't recognize data in image file
"C:\Users\shota\AppData\Local\Temp\RtmpmmOriu\filed04c9e079d4.jpg".

Is this a bug?

 My session info is shown below.
> R Under development (unstable) (2020-07-08 r78794)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=Japanese_Japan.932  LC_CTYPE=Japanese_Japan.932
[3] LC_MONETARY=Japanese_Japan.932 LC_NUMERIC=C
[5] LC_TIME=Japanese_Japan.932

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets
[7] methods   base

other attached packages:
[1] magick_2.4.0

loaded via a namespace (and not attached):
[1] compiler_4.1.0 magrittr_1.5   Rcpp_1.0.5

	[[alternative HTML version deleted]]



More information about the R-devel mailing list