title: Fit the length and width of the image with the screen, larger size / c# unity
body: <p>I have a script to download an image
  I want the image height and width to match the screen</p>
  <p>img
  [1]: <a href="https://i.stack.imgur.com/0VcAT.png" rel="nofollow noreferrer">https://i.stack.imgur.com/0VcAT.png</a></p>
  <p>The image should be in the best view to the user
  By the way, it's an app for watching manga</p>
  <p>&quot; I tried very hard to convey the idea in the best way, and I hope I succeeded ^_^ &quot;</p>
  <p>Thanks for the help</p>
  <p>The Script</p>
  <pre><code>public IEnumerator GetImage(string url)
  {
      UnityWebRequest www = UnityWebRequestTexture.GetTexture(url);
      yield return www.SendWebRequest();
  
      Texture2D myTexture = DownloadHandlerTexture.GetContent(www);
  
  
      //خوارزمية تعديل حجم الصورة 
      // Give all 100 of the length or width one number
     for(int i = 1; i &lt; 40;)
     {
         if(i*100 &gt; myTexture.width)
         {
             for(int u = 1; u &lt; 40;)
             {
                if(u*100 &gt; myTexture.height)
                {
                  WidthX = i;
                  HeightX = u;
                  u = 100;
                  i = 100;
                } 
                 u++;
             }
         }
         i++;
     }
  
      // After reducing all 100 to one, scale it down to fit the screen
      WidthX = WidthX / 3;
      HeightX = HeightX / 3;
  
      //Create sprite and set a Width and Height
      Rect rec = new Rect(0, 0, myTexture.width, myTexture.height);
      OImg.sprite = Sprite.Create(myTexture, rec,  Vector2.zero);
      OImg.GetComponent&lt;RectTransform&gt;().localScale = new Vector3 (WidthX,HeightX,1);        
      
  
  }
  </code></pre>
  <p>I changed the size of the image by (localScale) and I think this is a mistake</p>
  <p>must be modified &quot; Rect Transform Width And Height &quot; for Image</p>