parameters: (img, layers, compression, dir_name)
docstring: Takes a list of layers and saves them in `dir_name` as PNGs,
          naming the files after their layer names.
docstring_summary: Takes a list of layers and saves them in `dir_name` as PNGs,
          naming the files after their layer names.
docstring_tokens: Takes a list of layers and saves them in dir_name as PNGs naming the files after their layer names .
function: def save_layers(img, layers, compression, dir_name):
      ''' Takes a list of layers and saves them in `dir_name` as PNGs,
          naming the files after their layer names.
      '''
  
      for layer in layers:
          tmp_img = pdb.gimp_image_new(img.width, img.height, img.base_type)
          tmp_layer = pdb.gimp_layer_new_from_drawable(layer, tmp_img)
          tmp_layer.name = layer.name
          tmp_img.add_layer(tmp_layer, 0)
          filename = '%s.png' % layer.name
          fullpath = os.path.join(dir_name, filename)
          tmp_img.resize_to_layers()
          pdb.file_png_save(
              tmp_img,
              tmp_img.layers[0],
              fullpath,
              filename,
              0, # interlace
              compression, # compression
              1, # bkgd
              1, # gama
              1, # offs
              1, # phys
              1 # time
          )
function_tokens: def save_layers ( img , layers , compression , dir_name ) : for layer in layers : tmp_img = pdb . gimp_image_new ( img . width , img . height , img . base_type ) tmp_layer = pdb . gimp_layer_new_from_drawable ( layer , tmp_img ) tmp_layer . name = layer . name tmp_img . add_layer ( tmp_layer , 0 ) filename = '%s.png' % layer . name fullpath = os . path . join ( dir_name , filename ) tmp_img . resize_to_layers ( ) pdb . file_png_save ( tmp_img , tmp_img . layers [ 0 ] , fullpath , filename , 0 , # interlace compression , # compression 1 , # bkgd 1 , # gama 1 , # offs 1 , # phys 1 # time )