1/18/2017
How to Create Vector Graphics and High Resolution Images of your Tableau Visualizations



In working on the Big Book of Dashboards with Steve Wexler and Andy Cotgreave, I had the need to have high resolution graphics for the book for two dozen dashboards and various other images. My end goal was to get the best image for print that I could create, preferably a vector graphic. The source in most of these cases was a Tableau workbook. I've been meaning to post these methods in case others have this need. The learnings here come from countless hours of work, so hopefully what I share with you can help you if the need arises.

I will walk through the various options I explored and list the advantages and disadvantages of these approaches. Before I do that, a quick reference on image types.

1. Raster graphics (also called bitmapped or pixel graphics) have a 1-to-1 pixel representation of the image. The higher the resolution, the better the quality of the image. When zoomed in too far the image will pixelate.
2. Vector graphic use math to represent the image, the geometric patterns that comprise the image. Because they are calculated they can be enlarged without distortion, as they are not dependent upon the resolution of the image, i.e. the number of pixels used.
3. Enhanced Metafile (EMF) is another type of file that can combine bitmapped images and vector graphics. This is a Windows specific file, but can be opened in other programs, for example Adobe Illustrator.
4. PDF is another type of file that can be a bitmapped image or a vector graphic.

You can find more information on-line about the various file types. Here is one example with a nice outline of each file type.

The goal of this post is to show you various methods for creating a high-resolution bitmapped image (PNG, JPG or BMP) or a vector graphic, which doesn't have the same limitations and can be converted to high-resolution if needed.

First, a list of caveats, which will be common among most of these approaches when working with Tableau workbooks.

1. Custom images used in your Tableau viz will be raster images. This includes logos or other images added using the image object on a Dashboard.
2. Custom shapes used in your Tableau viz will be raster images.
3. Map layers will be raster images (discussed more below).
4. User Interface components (specifically sliders and dropdown boxes) will not export, only the selections themselves will export.

The rest of the visualization can be rendered as a vector graphic or a high resolution raster image.

So let's explore some of the options.

Export Image from Tableau


This is the standard method. Click on "Dashboard" (or "Worksheet") from the menu and the select "Export Image". This will allow you to save as PNG, BMP, JPG or EMF. The PNG, BMP and JPG will give you a standard size image of the dashboard. The resolution is not very high, so we'll explore other ways to get a higher resolution. Exporting as an EMF is one of those ways, because it can be opened in Adobe Illustrator. Once in Adobe Illustrator you will have a vector graphic of the dashboard (except for the caveats listed above). More on Adobe Illustrator later. One problem you may encounter with doing this is that you may lose your fonts and when opening an EMF file in Adobe Illustrator there is no font replacement warning as there is when opening a PDF as described next, so be sure to check your fonts.

Print to PDF


This one is fairly straight forward. Select "File" and "Print to PDF". You will notice that when viewing this file in a PDF reader that you can zoom in without pixelation (because the text and graph parts will be a vector graphic). Open the PDF in Adobe Illustrator. Once in Adobe Illustrator you will have a vector graphic of the dashboard (except for the caveats listed above).

Set the pixel ratio on Tableau Server


If the visualization is on Tableau Server or Tableau Public then you can set the pixel ratio as a parameter in the URL.

     http://[server name here]/#/views/[workbook name here]/[workbook name here]?:pixelratio=1 (any value 1 to 10)

The pixel ratio is 1 by default and is 2 for higher resolution displays (ex. retina displays). You can set this value up to 10. Once the visualization renders in the browser then click "Download" and then "Image" and it will save the file at this higher resolution.

For Tableau Public, just subsitute your workbook and worksheet name in the URL with the pixel ratio parameter.
     https://public.tableau.com/views/[workbook name here]/[workbook name here]?:pixelratio=10

As an example, here is Andy Kriebel's Mass Shooter Viz as a high resolution PNG.
https://public.tableau.com/views/MassShootings_3/MassShootings?:pixelratio=10&:showVizHome=no

Once the viz loads in the browser, click "Download" and then "Image" and it will download at the highest resolution available.

Download higher resolution from Tableau Public or Tableau Server using browser zoom


You can use the zoom on your browser to create higher resolutions on Tableau Public and Tableau Server. Load the visualization that you want to download in your browser. Then use the zoom controls to zoom in. Firefox will zoom up to 300%, Chrome will zoom up 1000% (under Custom) and Internet Explorer will go to 999% (Note - you can modify the zoom settings in Firefox if necessary). Once you increase the zoom level, refresh your browser so that the visualization will reload. This will cause the visualization to load at a higher resolution. After the visualization has loaded you can set the browser back to 100%, but make sure not to reload the page. Click "Download" and then "Image" and the visualization will download at a higher resolution.

Here are a few examples of file size and image dimensions using the browser zoom on my Twitter Zen viz here.

Chrome at 100% zoom: PNG file is 125kb and the dimensions are 984x684
Chrome at 400% zoom: PNG file is 613kb and the dimensions are 3936x2736
Chrome at 800% zoom: PNG file is 1.35mb and the dimensions are 7872x5472
Chrome at 1000% zoom: PNG file is 1.81mb and the dimensions are 9840x6840

You will notice that it's proportional based on the zoom level, as we would expect. Also, even though this is not a vector graphic, notice it is a much higher resolution so you can zoom in much more before the visualization starts to pixelate.




However, as mentioned in the caveats above, custom images and shapes can be problematic. In this example, while the text and bar chart above look great, the zen logo below is pixelated.




Notes on Adobe Illustrator


When first opening a PDF file in Adobe Illustrator you may be prompted to locate the fonts used in the Dashboard. (Note: this doesn't occur when opening an EMF file in Adobe Illustrator.) You will need to have the fonts on your system that are used in the dashboard, otherwise the text on the dashboard will not render properly. Select "Find Fonts..." from the Missing Fonts window. If there is no Missing Font window then select "Type" and then "Find Font...".



Locate the system fonts for any fonts that is missing. You can do this by matching them each to the system font and then selecting "Change All". Be careful of the font spacing when changing from one font to a different font. Once the fonts have been changed, you will now have a vector graphic in Adobe Illustrator (except for the caveats mentioned above).



If you need to reset the view to see the full dashboard in Adobe Illustrator at any time, click "View" and "Fit Artboard in Window". This is also helpful to see all of the objects in the window, for example an object that is outside of the dashboard canvas.

Next, release the clipping mask on all of the objects:
Chose "Select" in the menu
Click "All" to select everything or press CTRL-A.
Select "Object" from the menu and under "Clipping Mask".
Select "Release" (or press ALT-CTRL-7).

You can now select individual objects (dots, lines, letters) on the dashboard as needed to make edits. After making edits you can set a new artboard if needed by selecting "Object" from the menu, then "Artboards" and select "Fit to Artwork Bounds". In my case, I selected the outter most box surrounding the dashboard canvas and set the Artboard to that.

If you used custom images or custom shapes then you can replace them in Adobe Illustrator to get higher resolution. Simply delete the pixelated image and then insert a new image in it's place. This can be useful for things like company logos or other images that you have in high resolution but that are showing up pixelated.

Once the image is ready in Adobe Illustrator, select "File" from the menu, then select "Export". This allows you to export to various raster image file types and at various resolutions.

What to do about those other caveats


One option for maps is to use a program called ImageMagick. This is discussed in detail on this Tableau Community thread. Cristian Vasile posted a script and was able to convert EMF files to a huge raster file. This technique was used to create a wall-sized poster for one of the Tableau Conferences.

Another option for maps is to use map shapes from geographic fields or custom polygons. Here is an example of points plotted using a typical map layer in Tableau and exported as an image. Notice the pixelation on the map layer.



Here is the same data plotted on the map using the state outline only with the map layer turned off. Notice the difference in resolution when exported. The state outline will export as a vector graphics as well.




For custom shapes, there is a great post here by Colby Pash on how to base64 encode your images by replacing the image code in the XML file. This allows for higher resolution of the custom shapes used in a Tableau workbook.

The last one I'll discuss seems to have stopped working with Tableau 10.x, but it's worth a mention anyway. Steve Wagner figured out you could take a base64 encoded image and put that code in the URL window of a Web Object on a Tableau Dashboard.

Here are the steps he outlined:

1. Base64 encode your image using a site like https://www.base64-image.de/
2. Copy the data:image/png;base64,… code
3. Add a Web Page object to the dashboard
4. Paste the code from step 2 as the URL

Unfortunately, I tested this with Tableau 10.x and even confirmed with Steve to make sure I wasn't missing anything. And even though it does work in prior versions of Tableau (I tested in 9.3 and 9.2), it will not save the image to Tableau Public and the image will not show up when exporting to PNG or PDF. You might have also thought to create a webpage with an image and then embed the webpage on the dashboard canvas, but unfortunately this yields the same result and will not export.

The UI components, for example slider controls and dropdown boxes, won't export either. The only real option for this is 1.) using a screen capture tool in low resolution or 2.) to recreate them in Adobe Illustrator after you've exported the image. The later is what we ended up doing for many of the images in our book. Once we created a few of them we were able to copy and paste onto other dashboards.

At the end of the day, I achieved the best result by saving to PDF and then opening the file in Adobe Illustrator. This required additional work to deal with all of those caveats that I listed, but in the end this was the best option and the end results were beautiful Tableau dashboards in Adobe Illustrator that were vector graphics.

Here's an example from one of the dashboards featured in our upcoming book (in very low resolution).



Here is a very small section that is zoomed in to just a few dots on the plot. Because this is a vector graphic created in Adobe Illustraor it can be zoomed in with perfect resolution at any size needed. Then I exported to a high resolution JPG image shown below.




I hope you find this information helpful. If you have any questions feel free to email me at Jeff@DataPlusScience.com

Jeffrey A. Shaffer
Follow on Twitter @HighVizAbility