Texture2D ResizeImgWithHeight(Image <Rgb, byte> img, float height) { img = img.Resize((int)((float)img.Width / (float)img.Height * height), (int)height, Inter.Nearest); return(IExtension.ImageToTexture2D(img)); }
void ChangeBackgroundImg(Image <Rgb, byte> img) { // Background Image Texture2D CanvasTexture = IExtension.ImageToTexture2D(img); backimg.sprite = Sprite.Create(CanvasTexture, new Rect(0, 0, CanvasTexture.width, CanvasTexture.height), Vector2.zero); backimg.rectTransform.sizeDelta = new Vector2(CanvasTexture.width, CanvasTexture.height); IExtension.SetTransparency(backimg, 0.3f); }