class_docstr: Class to generate line style table.
class_docstr_tok: ["Class","to","generate","line","style","table","."]
docstr: Generate and save an image of the given line_style.
docstr_tok: ["Generate","and","save","an","image","of","the","given","line_style","."]
code: def generate_img(line_style, img_path):
      """Generate and save an image of the given line_style."""
      p = pv.Plotter(off_screen=True, window_size=[100, 50])
      p.background_color = "w"
      chart = pv.Chart2D()
      chart.line([0, 1], [0, 0], color="b", width=3.0, style=line_style)
      chart.hide_axes()
      p.add_chart(chart)
  
      # Generate and crop the image
      _, img = p.show(screenshot=True, return_cpos=True)
      img = img[18:25, 22:85, :]
  
      # exit early if the image already exists and is the same
      if (
          os.path.isfile(img_path)
          and pv.compare_images(img, img_path) < 1
      ):
          return
  
      # save it
      p._save_image(img, img_path, False)
  
imports: import io
  import os
  import textwrap
  import pyvista
label_desc: Use image node_id 4 for calling the LineStyleTable obj's underlying member method code with example usage: obj.generate_img(line_style, img_path) without return types