Optical testing may require gratings, slits or pinholes, etc… to be positioned in the optical path. Those items can be traditionally manufactured, which is usually expensive given the precision required. Alternatively, they can be printed on a 24mm x 36mm slide.

Printing gratings on slides is nothing new, and services like RonchiScreens have served the amateur community for years. They stopped production in 2020 due to the difficulty to source printing services. This valuable ressource disappearing is what motivated me to develop the present script and extend the method to other screens types.

The script below generates high definition images in a format of your choice, ready to be sent to a professional slide printer shop. Use lossless compression formats, like PNG (or TIFF if that is what your printing service require). The images come ready for the maximum definition available commercially for slides, which is “8K”.

This Python 3 scripts creates collections of:

  • A Knife Edge
  • Ronchi gratings
  • Pin Holes
  • Slits
  • Double slits
  • Color Schierlien gratings
  • Obstructions
  • Color filters


  • Using 8K slide printing services, about 4 micron accuracy can be achieved. 36mm divided by 8,192 pixels gives 4 microns by pixel.
  • Slide printing machines with 8K resolution have not been manufactured for 15 years, and the service can be difficult to source. 4K machines are very common and may be sufficient for your application. Example of US printing service here.
  • Silver-halide crystals (the grain of the black and white picture) are 0.2- 2.0 microns diameter, a perfect match for the 8K resolution. The color dye, however is less accurate: around 10 micron. Discussion on film resolution and grain size here.
  • Using “direct write laser photomask technology”, 2 micron +/- 0.3 can be achieved, even on glass. Example and discussion here.
  • For comparison good regular machining has a precision of about 20 microns, exceptional “precision machining” can be around 1 microns in the best cases.

Conclusion: the film gratings proposed here, printed in 8K are accurate enough for all but the most extreme uses. Finding a true 8K printer will be a challenge however. Printing in 4K is sufficient for the coarser gratings and less demanding applications. That service is cheap ($2 per slide in 2020) and easy to source. It still should be more accurate than most mechanical manufacturing, and way cheaper. If you demand very high precision and can afford it, laser mask technology is for you. The present script carters to all those needs.

The collection below likely covers all the templates you may require for 24×36 prints, but if you desire something different, the script is easy to modify.

Here is a sampler of the gratings generated by the script.

If your printing service requires TIFFs, you will have to run the script (or convert the PNGs), as TIFFS are too big to distribute here.