(Fixed in b19) Masking JPG image

Seems I can’t mask a JPG image that’s loaded in at runtime. I’ve tried converting it to a format with alpha channel, but no dice. Bug or am I doing it wrong (again)?

The image loads fine, converts to PNG fine, but shows as a hard square, without the rounded corners of the mask.

“Profile Pic Mask” is a PNG sprite with transparency (rounded corners). “Profile Pic” is a JPG Facebook profile image.

1785305--113528--Screen Shot 2014-09-24 at 10.04.23 am.png

How I’m loading the image:

IEnumerator loadPictureEnumerator(string url, IUserProfile targetUser, System.Action<bool> callback) 
        {
            WWW www = new WWW(url);
            yield return www;
            // Check for error
            if (!String.IsNullOrEmpty(www.error)) {
                callback.Invoke(false);
                Logger.e(www.error);
            } else {
                // Convert to PNG with alpha channel
                UnityEngine.Texture2D pngTex;
                var bytes = ((UnityEngine.Texture2D) www.texture).EncodeToPNG();
                pngTex = new Texture2D(128, 128, TextureFormat.ARGB32, false);
                pngTex.LoadImage(bytes);
             
                // Assign
                switch (targetUser.GetType().ToString()) {
                    case "EyeBopCoSocial.UserProfile":
                        ((EyeBopCoSocial.UserProfile) targetUser).image = pngTex;
                        break;
                    case "EyeBopCoSocial.LocalUser":
                        ((EyeBopCoSocial.LocalUser) targetUser).image = pngTex;
                        break;
                }
                callback.Invoke(true);
            }
        }

In fact, taking the remote image loading out of the equation it still doesn’t work. If I set a texture on the Raw Image it still just shows without the mask, both in Scene and Game views, no matter which platform I’m publishing to.

Mask with transparency at corners:
1785374--113536--Screen Shot 2014-09-24 at 11.15.11 am.png

With Raw Image as child of it:
1785374--113537--Screen Shot 2014-09-24 at 11.15.17 am.png

Just updated to beta 19. Working now! :slight_smile: