title: Pygments and ImageFormatter: set output to 80 columns
body: <p>The <code>ImageFormatter</code> always creates a PNG output which width depends on the line length.</p>
  <p>For example, this PNG is 192 pixels wide:</p>
  <p><a href="https://i.stack.imgur.com/sv61y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sv61y.png" alt="short" /></a></p>
  <p>and this is 384:</p>
  <p><a href="https://i.stack.imgur.com/MwGuI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MwGuI.png" alt="long" /></a></p>
  <p>Is there a setting in <code>Pygments</code> to emulate a 80 column output, so all images will have the same width?</p>
  <p>This is the code I used to produce the examples:</p>
  <pre><code>#!/usr/bin/python3
  
  from pygments import highlight
  from pygments import lexers
  from pygments.formatters.img import ImageFormatter
  from pygments.styles import get_style_by_name, get_all_styles
  
  lexer = lexers.get_lexer_by_name('C')
  
  source_short = 'printf(&quot;%d\\n&quot;, i);'
  source_long = 'printf(&quot;variable i is equal to %d.\\n&quot;, i);'
  
  formatter = ImageFormatter(full = True, style = get_style_by_name('vim'))
  open('short.png', 'wb').write(highlight(source_short, lexer, formatter))
  formatter = ImageFormatter(full = True, style = get_style_by_name('vim'))
  open('long.png', 'wb').write(highlight(source_long, lexer, formatter))
  </code></pre>