This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I'm trying to use some images within an R plot. I would like to feed the images directly into the R tool and leverage in a plot. The only way I've been able to get it to work is save all the images to a folder and read back into R using the readPNG function (png package). I've tried converting the images to binary but that did not work either. Is there another R package available that will allow me to read the Alteryx image format without having to save them to disk? Any examples of how to do this?
The R tool can only read the data in via the connection as a list or as a dataframe. This limits your options to storing the PNG file as/in a dataframe and then converting it back using R code. Depending on what you are going to do with it as to whether this is actually a good idea. If you are planning to search the image looking for patterns then it may be practical to convert the image to binary, but in most cases saving it to disk or blob in a DB and then reading it back in using R script is going to be best (and by far and away easiest).
My intent was to show profile pics within a hierarchy using igraph, so it can be up to 100 png images or more. I'll look into loading them as dataframe and converting, but if that doesn't work out I'll keep the approach I have to save to disk and read back in. Thanks!
Hello - just a couple thoughts from outside the box, and therefore possibly inapplicable:
Are the images actually generated as part of the workflow, or loaded by the workflow and then passed to R? If not generated during the workflow, consider not loading them at all: just pass the image path to R; (or a vector of paths) and let R do the only image load.
Another thought is, depending on how the final output is rendered, could the path be passed all the way through? (e.g. if rendered as HTML, all it's going to do is store the object somehow and then reference it... perhaps if you could make the HTML put an "img" tag in the relevant cell that references the original image: you can have no image loading at all, ever, until someone actually loads the resulting HTML and views it. This would also allow you to change the image at any time, as long as you use the same filename, without worrying if the existing rendering will pick it up or not).
Thanks for the ideas. The images are pulled into the workflow at run time, so it grabs the latest photo. I wish I could easily deploy it as html but for now the hierarchy plots will be rendered as images or PDFs.
Hopefully one day we'll have Alteryx Server so we can publish to the gallery and take the html approach you mentioned.