Q:

Drawing a B/W grating

I'm trying to create a .tif or .jpg image that will be used in full screen mode. The image should be filled with black and white thick lines. I need to set a width variable so I can create different images with different line thickness.  I can't figure out how to do it. Any ideas ?

A:

Some thing like this?
\documentclass{article}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    \foreach \x in {2,4,6,...,48}{
    \draw[line width=1mm] (\x mm,0) -- (\x mm, 2);
    }
    \begin{scope}[yshift=3cm]
    \foreach \x in {3,6,...,48}{
    \draw[line width=1.5mm] (\x mm,0) -- (\x mm, 2);
    }
    \end{scope}
  \end{tikzpicture}
\end{document}

To get it in .jpg format, compile this code:
\documentclass[tikz,convert=jpg]{standalone}
\begin{document}
  \begin{tikzpicture}
    \foreach \x in {2,4,6,...,48}{
    \draw[line width=1mm] (\x mm,0) -- (\x mm, 2);
    }
  \end{tikzpicture}
\end{document}

with imagemagick installed and -shell-escape option enabled.
To use it in full screen, compile this code
\documentclass[tikz,convert=jpg]{standalone}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    \foreach \x in {2,4,6,...,48}{
    \draw[line width=1mm] (\x mm,0) -- (\x mm, 2);
    }
  \end{tikzpicture}
\end{document}

and put it in full screen (press ctrl+L)

