lib/songster/generator.rb
def create_mouth_top_crop(mouth)
      crop_size = "#{mouth.width}x#{mouth.height+5}"
      crop_location = "+#{mouth.left_x}+#{mouth.top}"

      Commander.run!("convert #{@dir}/original.miff",
                     "-fill black -stroke black",

                     "-draw \"path '",
                     # Start line at the top left point
                     "    M #{mouth.left}",

                     # Draw a curve to the right point.
                     "    C #{mouth.center_x},#{mouth.center_y+5}",
                     "      #{mouth.center_x},#{mouth.center_y+5}",
                     "      #{mouth.right}",

                     # Draw a straight line to a point below the right point.
                     "    L #{mouth.right_x},#{mouth.bottom+5}",

                     # Draw a straight line to a point below the left point.
                     "    L #{mouth.left_x},#{mouth.bottom+5}",

                     # Close the figure so it can be filled.
                     "    Z",
                     "'\"",

                     "-crop #{crop_size}#{crop_location}",

                     "#{@dir}/top.miff")
    end
# Create a crop of the mouth upper lip with black padding on the bottom
Create a crop of the mouth upper lip with black padding on the bottom
Create a crop of the mouth upper lip with black padding on the bottom
def create_mouth_top_crop(mouth)
      crop_size = "#{mouth.width}x#{mouth.height+5}"
      crop_location = "+#{mouth.left_x}+#{mouth.top}"
      Commander.run!("convert #{@dir}/original.miff",
                     "-fill black -stroke black",
                     "-draw \"path '",
                     "    M #{mouth.left}",
                     "    C #{mouth.center_x},#{mouth.center_y+5}",
                     "      #{mouth.center_x},#{mouth.center_y+5}",
                     "      #{mouth.right}",
                     "    L #{mouth.right_x},#{mouth.bottom+5}",
                     "    L #{mouth.left_x},#{mouth.bottom+5}",
                     "    Z",
                     "'\"",
                     "-crop #{crop_size}#{crop_location}",
                     "#{@dir}/top.miff")
    end
def create_mouth_top_crop ( mouth ) crop_size = "#{mouth.width}x#{mouth.height+5}" crop_location = "+#{mouth.left_x}+#{mouth.top}" Commander . run! ( "convert #{@dir}/original.miff" , "-fill black -stroke black" , "-draw \"path '" , "    M #{mouth.left}" , "    C #{mouth.center_x},#{mouth.center_y+5}" , "      #{mouth.center_x},#{mouth.center_y+5}" , "      #{mouth.right}" , "    L #{mouth.right_x},#{mouth.bottom+5}" , "    L #{mouth.left_x},#{mouth.bottom+5}" , "    Z" , "'\"" , "-crop #{crop_size}#{crop_location}" , "#{@dir}/top.miff" ) end
Create a crop of the mouth upper lip with black padding on the bottom
Create a crop of the mouth upper lip with black padding on the bottom
# Start line at the top left point # Draw a curve to the right point. # Draw a straight line to a point below the right point. # Draw a straight line to a point below the left point. # Close the figure so it can be filled.
mouth