What method can I use to apply a JPG image to a surface?

What method can I use to apply a JPG image to a surface (Python)?

public static Rhino.Commands.Result AddMaterial(Rhino.RhinoDoc doc)
    {
      // materials are stored in the document's material table
      var mat = new Material();
      mat.DiffuseColor = System.Drawing.Color.Chocolate;
      mat.SpecularColor = System.Drawing.Color.CadetBlue;

      var texture = new Texture();
      texture.FileName = "my_image.jpg";
      mat.SetTexture(texture, TextureType.Bitmap);

      var rm = RenderMaterial.CreateBasicMaterial(mat, doc);

      doc.RenderMaterials.Add(rm);

      // set up object attributes to say they use a specific material
      Rhino.Geometry.Sphere sp = new Rhino.Geometry.Sphere(Rhino.Geometry.Plane.WorldXY, 5);

      var id = doc.Objects.AddSphere(sp);

      var rhinoObject = doc.Objects.Find(id);

      rhinoObject.RenderMaterial = rm;
      rhinoObject.CommitChanges();

      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }

I have another question.
On the flat figure I applied a texture image using flat mapping.
Both figures have the same number of faces.
How do I get the same texture in the 3D figure?
Same proportion.

My knowledge is limited to a little bit of python and Grasshopper.