From rwo|d|ord @end|ng |rom uw@ter|oo@c@  Fri Jun 12 15:53:26 2020
From: rwo|d|ord @end|ng |rom uw@ter|oo@c@ (Wayne Oldford)
Date: Fri, 12 Jun 2020 13:53:26 +0000
Subject: [Rd] 
 tcltk image reading problem (on a mac?): [tcl] encountered an
 unsupported criticial chunk type "eXIf"
In-Reply-To: <39ffed02-7044-fc01-970e-986cebf1cb2f@stats.ox.ac.uk>
References: <FEAE9DA5-8206-4025-BA52-790717E27455@contoso.com>
 <274D88FD-B4E7-40E4-9814-24C5B70F858D@gmail.com>
 <22794_1591915402_05BMhLe6010602_BN8PR05MB6321E2E5C596C22180D6E1C7FC800@BN8PR05MB6321.namprd05.prod.outlook.com>
 <E574B396-3A22-4749-89DA-9027389AC78F@mcmaster.ca>
 <41413BD1-966E-4454-B674-AB58EC4786C0@uwaterloo.ca>
 <AE3CE86B-5591-4794-8687-3CFC9E1F97EB@R-project.org>
 <52B0A0EF-3BF4-4010-B21A-CD85B0C4B33E@mcmaster.ca>
 <39ffed02-7044-fc01-970e-986cebf1cb2f@stats.ox.ac.uk>
Message-ID: <4547282C-E31D-4279-933C-C2C8DA012B4D@uwaterloo.ca>


Thanks everyone for getting a solution.

Brian's solution works for me too. 

Thanks again!!

Wayne


?-----Original Message-----
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Date: Friday, June 12, 2020 at 3:00 AM
To: "Fox, John" <jfox at mcmaster.ca>, Simon Urbanek <simon.urbanek at r-project.org>
Cc: Wayne Oldford <rwoldford at uwaterloo.ca>, "r-devel at r-project.org" <r-devel at R-project.org>
Subject: Re: [Rd] tcltk image reading problem (on a mac?): [tcl] encountered an unsupported criticial chunk type "eXIf"

    On 12/06/2020 03:49, Fox, John wrote:
    > Dear Simon,
    > 
    >> On Jun 11, 2020, at 9:00 PM, Simon Urbanek <simon.urbanek at r-project.org> wrote:
    >>
    >> Wayne,
    >>
    >> that one is unrelated, but interesting - you can fix it with
    >>
    >> sudo install_name_tool -change \
    >>   /usr/local/lib:/opt/X11/lib/libtk8.6.dylib \
    >>   /usr/local/lib/libtk8.6.dylib \
    >>   /usr/local/bin/wish8.6
    >>
    >> There is a bug in tcltk with IDs on the libraries which I have worked-around for R, but not for wish.
    >>
    >> Back to the original question - do you have any example of a file that doesn't work so I could test? Exif chunks are fairly rare in PNG and are a more late extension so I couldn't find any examples.
    > 
    > The code in Wayne's original message (copied below) generated the offending file:
    > 
    > library(tcltk)
    > 
    > fname <- "Rplot.png"
    > png(filename = fname, width = 500, height = 500)
    > hist(rnorm(20))
    > dev.off()
    > 
    > tkimage.create("photo", file = fname)
    
    There are several png() devices for R.  The default on macOS is to use 
    Quartz, and that depends on macOS system functions so might well have 
    changed with Mojave -> Catalina.
    
    As a workaround, try e.g. png(type='cairo').  E.g.
    
    fname <- file.path(tempdir(), "Rplot.png")
    png(filename = fname, width = 500, height = 500, type="cairo")
    hist(rnorm(20))
    dev.off()
    
    library(tcltk)
    tkimage.create("photo", file = fname)
    
    works for me on Catalina.
    
    
    -- 
    Brian D. Ripley,                  ripley at stats.ox.ac.uk
    Emeritus Professor of Applied Statistics, University of Oxford
    



[Rd] tcltk image reading problem (on a mac?): [tcl] encountered an unsupported criticial chunk type "eXIf"
Wayne Oldford