Skip to main content

How to export large graphics?


I'm using Raster to create large graphics (1000 by 1666), which I want to Export as a JPEG or TIFF in a resolution that can be printed in a large size, 3' by 5'. I'm lost in the maze of options available, and my exported files are always at very low resolution.



Answer



First, some clarifications:




  • pure image size: pixels × pixels





  • Mathematica ImageSize: the distance x distance of the image, defined as a multiple of 1/72'', which is approximately 0.353 mm (1/72'' is called a printer's point)




  • printing size: distance × distance on the printing media




  • printer resolution (dpi): depends on printer characteristics; it's the number of small drops it can place in a linear inch; nowadays, above 1000 dpi; generally, due to the mechanical characteristics of the printer, it can put more points in a "horizontal" line than in a vertical line; some printers allow this value to be changed for ink economy.





  • image resolution printing output (dpi): the amount of pixels defined on the image that will be placed in a 1 inch row or column, on the sheet of paper




  • Mathematica ImageResolution: a way to specify how many pixels to generate on the exported file, etc.




So, let's suppose you have a 1000 × 1000 pixels image file. What is the resolution of your image? If it is not shown, neither on the screen, nor on paper, it has no resolution (sure your image software can register in a file a specific value for the resolution, but this value has absolutely no impact on your image, see it as something like the date on a digital photograph.)


(I'm sure someone from the "printing" business would not agree with some of the words I used, but let's use this as my personal practical definition)


If you print that 1000 × 1000 pixels image on a 4" × 4" size paper, it will have a image resolution printing output of 1000/4"= 250 dpi. If you printed with a printer resolution of 2500 × 2500 dpi, then your printer placed 10 × 10 drops of ink to render each pixel of your digital image (this also allows for a correct color rendering from just 3 or 5 different ink recipients).


If you display the same 1000 × 1000 image on your screen, with a 100 % zoom (where each pixel of the image occupies exactly one pixel on your screen), most likely, your image will measure 1000/72" (if you use a ruler), since most screens have a resolution of 72 dpi (recent laptops may have substantially higher resolution).



So, another important question is: What should be my image resolution printing output?


When printing, you should have an image resolution printing output adapted to the distance at which the image will be seen. It is common to say that someone with a 20/20 sight is able to distinguish 0.3 to 0.4 arc minutes at maximum. Considering the value 0.3, we could say that, for the printing to be perfect, the image resolution printing output, in dpi, should be (360/(0.3/60))/(2 d*Pi), where d stands for the distance of viewing (in inches).


Nevertheless, I'll add here my personal experience on printed results (where, for obvious reasons, things aren't so perfect as on perfectly geometrical displays): below 150 dpi, you will start to easily see the pixels on your printed support; above 300 dpi, only with very precise printers, and looking closely, will you see a difference to the same image at 300 dpi. Out of curiosity, these practical limits correspond on a perfect vision to a distance between 1 to 2 meters.


For your example, a 3' × 5' print, I think that 200 dpi image resolution printing output is more than enough, since it is probably a print that will be observed from a certain distance. Everyone farther than 1,5 m will be beyond physical capability to distinguish pixels; and I would add that up to 1/4th of this distance, the image will still be perfectly acceptable (after-all, we have been living pretty happy with 72/96 dpi displays up to not so long ago...)


This means you would need 3 × 12 × 200 by 5 × 12 × 200 = 7200 × 12000 pixels on your file.


How to generate this on Mathematica?


There are a lot of different ways. I will show you a couple of examples.


The following creates an image of 100 "printer points" (horizontal), meaning 100*1/72'', which corresponds to approximately 36 mm.


a = Plot[x^2, {x, 0, 1}, ImageSize -> 100]


Unfortunately, what that means is a little hard to understand, since the size that image will occupy on your screen is probably not 36 mm. It depends on the Magnification, the difference between your screen true resolution and what Mathematica reads of it (not always match), etc. Nevertheless, if you activate the ruler (Windows->Show Rules), you will see that it matches. So, think of it more like a meta information...


The following exports the previously generated image with the default value of ImageResolution, which is 72 dpi. This means that you jpg file will have (100*1/72'')*72 dpi = 100 horizontal pixels.


Export["a.jpg", a]

The following exports a 200 horizontal pixel size image (it changes your original option, defined on the Plot)


Export["a.jpg", a, ImageSize->200]

And with the following you specify the ImageResolution for the Export function. This is probably what you are looking for.


Export["a.jpg", a, ImageResolution->200]


So, I recommend that you play around with ImageSize, to get a good looking image on your screen (the texts on the correct size, etc), and then Export it specifying the ImageResolution to get the 7200 × 12000 pixels file.


(See JPEG specifications to get it into a reasonable file size.)


Comments

Popular posts from this blog

front end - keyboard shortcut to invoke Insert new matrix

I frequently need to type in some matrices, and the menu command Insert > Table/Matrix > New... allows matrices with lines drawn between columns and rows, which is very helpful. I would like to make a keyboard shortcut for it, but cannot find the relevant frontend token command (4209405) for it. Since the FullForm[] and InputForm[] of matrices with lines drawn between rows and columns is the same as those without lines, it's hard to do this via 3rd party system-wide text expanders (e.g. autohotkey or atext on mac). How does one assign a keyboard shortcut for the menu item Insert > Table/Matrix > New... , preferably using only mathematica? Thanks! Answer In the MenuSetup.tr (for linux located in the $InstallationDirectory/SystemFiles/FrontEnd/TextResources/X/ directory), I changed the line MenuItem["&New...", "CreateGridBoxDialog"] to read MenuItem["&New...", "CreateGridBoxDialog", MenuKey["m", Modifiers-...

How to thread a list

I have data in format data = {{a1, a2}, {b1, b2}, {c1, c2}, {d1, d2}} Tableform: I want to thread it to : tdata = {{{a1, b1}, {a2, b2}}, {{a1, c1}, {a2, c2}}, {{a1, d1}, {a2, d2}}} Tableform: And I would like to do better then pseudofunction[n_] := Transpose[{data2[[1]], data2[[n]]}]; SetAttributes[pseudofunction, Listable]; Range[2, 4] // pseudofunction Here is my benchmark data, where data3 is normal sample of real data. data3 = Drop[ExcelWorkBook[[Column1 ;; Column4]], None, 1]; data2 = {a #, b #, c #, d #} & /@ Range[1, 10^5]; data = RandomReal[{0, 1}, {10^6, 4}]; Here is my benchmark code kptnw[list_] := Transpose[{Table[First@#, {Length@# - 1}], Rest@#}, {3, 1, 2}] &@list kptnw2[list_] := Transpose[{ConstantArray[First@#, Length@# - 1], Rest@#}, {3, 1, 2}] &@list OleksandrR[list_] := Flatten[Outer[List, List@First[list], Rest[list], 1], {{2}, {1, 4}}] paradox2[list_] := Partition[Riffle[list[[1]], #], 2] & /@ Drop[list, 1] RM[list_] := FoldList[Transpose[{First@li...

functions - Get leading series expansion term?

Given a function f[x] , I would like to have a function leadingSeries that returns just the leading term in the series around x=0 . For example: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x)] x and leadingSeries[(1/x + 2 + (1 - 1/x^3)/4)/(4 + x)] -(1/(16 x^3)) Is there such a function in Mathematica? Or maybe one can implement it efficiently? EDIT I finally went with the following implementation, based on Carl Woll 's answer: lds[ex_,x_]:=( (ex/.x->(x+O[x]^2))/.SeriesData[U_,Z_,L_List,Mi_,Ma_,De_]:>SeriesData[U,Z,{L[[1]]},Mi,Mi+1,De]//Quiet//Normal) The advantage is, that this one also properly works with functions whose leading term is a constant: lds[Exp[x],x] 1 Answer Update 1 Updated to eliminate SeriesData and to not return additional terms Perhaps you could use: leadingSeries[expr_, x_] := Normal[expr /. x->(x+O[x]^2) /. a_List :> Take[a, 1]] Then for your examples: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x), x] leadingSeries[Exp[x], x] leadingSeries[(1/x + 2 + (1 - 1/x...