Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Victor Ree · Sep 18, 2014 at 12:56 AM · jpg

I use WWW to display a jpg file, but it display a wrong image ?

i try to display this jpg (http://www.jxysh.cn/upload/1409091854047652145.jpg), but it display a wrong image

WWW www = new WWW("http://www.jxysh.cn/upload/1409091854047652145.jpg") ; StartCoroutine(WaitForWWWLoadImg(www);

... img.mainTexture = www.texture; //a wrong image

I also try tex.LoadImage(www.bytes) //wrong too

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Eric5h5 · Sep 18, 2014 at 01:03 AM

It's a CMYK image; Unity can only use RGB.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
-1

Answer by sarthakshah · Sep 18, 2014 at 04:59 AM

Below script is working for my png files, so just change your file extestion from jpg to png on server, and also change in url of below script, Hope this will work.

     using UnityEngine;
     using System.Collections;
     
     public class image : MonoBehaviour {
     
         Texture myImage;
         // Use this for initialization
         void Start () {
             string url="http://www.jxysh.cn/upload/1409091854047652145.jpg";
             StartCoroutine (getImage (url));
         }
         
        IEnumerator getImage (string url)
            {
             print ("Started");
             WWW www = new WWW (url);
             yield return www;
             
             //In myImage u will get your image
             myImage = www.texture;
             gameObject.renderer.material.mainTexture = myImage;
         }
     }







Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Eric5h5 · Sep 18, 2014 at 05:15 AM 0
Share

That doesn't help at all, since the problem is not the extension or the code. Changing the extension makes no sense since Unity can load jpg images fine, as long as they are valid. The problem is that the image is C$$anonymous$$Y$$anonymous$$ and Unity can only use RGB.

avatar image sarthakshah · Sep 18, 2014 at 05:21 AM 0
Share

Its an alternative, not solution,

If i have C$$anonymous$$Y$$anonymous$$ image , so what will be the solution?

Changing C$$anonymous$$Y$$anonymous$$ to RGB , is a solution?

avatar image Eric5h5 · Sep 18, 2014 at 05:31 AM 0
Share

The code won't be anything, since Unity doesn't support C$$anonymous$$Y$$anonymous$$ images. You're correct that changing the extension won't do anything; you'd have to load it into Photoshop and re-save it as RGB.

avatar image sarthakshah · Sep 18, 2014 at 05:34 AM 0
Share

but if the image which comes from server , and its in C$$anonymous$$Y$$anonymous$$ , then what?

i think we can't change it at runtime.

avatar image Eric5h5 · Sep 18, 2014 at 07:22 AM 2
Share

but if the image which comes from server , and its in C$$anonymous$$Y$$anonymous$$ , then what?

Then you're screwed. ;) I guess you could write your own image loader for C$$anonymous$$Y$$anonymous$$ images, but that's kind of a last resort if you were being forced to use C$$anonymous$$Y$$anonymous$$ for some strange reason. I think it would be a lot simpler just to stick to RGB images in the first place; C$$anonymous$$Y$$anonymous$$ is only used for printing and doesn't really have any place on the web.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Any way to show a picture on the screen when a model is clicked? 2 Answers

Is it possible to edit description field of jpg when saving screenshot? 2 Answers

Load image in runtime from jpg 1 Answer

Include jpg files without automatically converting to sprites or textures 1 Answer

use jpg in unity3d 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges