Difference between revisions of "Guidelines"

From Techniques for computer generated pictures in complex dynamics
Jump to: navigation, search
(Bitmaps)
(File format)
Line 1: Line 1:
 
== File format ==
 
== File format ==
 +
 +
I am not going to explain in length the difference between [http://en.wikipedia.org/wiki/Bitmap_graphics bitmaps] and [http://en.wikipedia.org/wiki/Vector_graphics vector] graphics. In short, the first is a rectangular array of pixels, the second is a description of curves by linear or simple curved pieces, and of areas bounded by these type of curves.
 +
 +
For simple objects, a vector graphics will take much less memory and will look perfect at any scale, while a bitmap's [[resolution]] (number of pixels) needs to be adapted to the situation. A bitmap is more adapted to complex images, like fractals or with elaborated coloring schemes.
  
 
=== Bitmaps ===
 
=== Bitmaps ===

Revision as of 19:02, 25 February 2014

File format

I am not going to explain in length the difference between bitmaps and vector graphics. In short, the first is a rectangular array of pixels, the second is a description of curves by linear or simple curved pieces, and of areas bounded by these type of curves.

For simple objects, a vector graphics will take much less memory and will look perfect at any scale, while a bitmap's resolution (number of pixels) needs to be adapted to the situation. A bitmap is more adapted to complex images, like fractals or with elaborated coloring schemes.

Bitmaps

As of 2014, I strongly recommend PNG for bitmapped images. It is a lossless compressed format. Pictures with large areas of uniform color compress particularly well. It has been my favorite for nearly 20 years. Back then, to include them in a TeX/LaTeX article there was a tedious conversion to be made from PNG to EPS but now it is recognized by default by pdfLaTeX. Of course I don't know what will be the situation in 20 years (anyway, will this wiki still exist?)

Pros:

  • lossless
  • free and open
  • widely supported by nearly all programs and OS
  • uniform areas compress well
  • can include metadata
  • pdfLaTeX takes it!

Vector

My favorite tool for creating/editing by hand vector images is Inkscape. Use SVG for saving loading editing and inclusion in webpages. Use PDF for exporting towards pdfLaTeX.

I do not have a firm preference for producing vector images of mathematical curves or sufaces. Some free and some commercial mathematical programs can output vector images. I was used to a complicated workflow: write a c/c++ program that outputs a postscript file, (sometimes directly write in postscript), then convert postscript to pdf with any tool for inclusion in pdfLaTeX.

Antialias

Even if you plan to include to produce a small image or include it in a web browser, thus need only low resolution, I recommend to produce a higher resolution picture first, and then downscale it. This is the principle of antialias. A double resolution $2W\times 2H$ already gives a very good improvement. I recommend using integer multiples. Note that for images with uniform color areas, the downscaled PNG will have a size comparable to the original, possibly bigger.

Caution: in some image manipulation programs, you need to convert paletted images to true color before downscaling, or the program may instead of averaging the color use the nearest matching color in the palette, resulting in the absence of antialias.