Search Issue Tracker
By Design
Votes
0
Found in
2017.4.0f1
2017.4.5f1
Issue ID
1106629
Regression
No
Loading a PNG file with Resources.Load<Texture2D> and Texture2D.LoadImage produces different results
To reproduce:
1. Download attached project "PNG Load.zip" and open in Unity
2. Open "test" scene
3. Enter to Play mode
4. Press "Load As PNG" button and observe results
5. Press "Load From Resources" button and observe results
Expected results: Observe that loading Texture by Resources.Load<Texture2D> and Texture2D.LoadImage produce the same results (Tone)
Actual results: Observe that loading Texture by Resources.Load<Texture2D> Texture is not the same when You load it directly from PNG by Texture2D.LoadImage
Notes:
- This issue appears on both Windows and macOS
- A Texture which loaded from Resources is lighter than loaded as PNG
- This issue does not happen with JPEG
Reproduced on Unity 2017.4.0f1, 2017.4.17f1, 2018.1.9f2, 2018.2.19f1, 2018.3.0f1 and 2019.1.0a11
Comments (3)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [URP] Crash on GameObject::QueryComponentByType when baking a Reflection Probe in an unsaved/untitled Scene
- No Icons are used for the Entry and Exit States in the Inspector when selected in an Animator Controller
- Crash on PlayerMain(int, char const**) when exiting Standalone Player with a Particle System in the Scene
- No Icon is used for the Runtime Animator Controller Type in a Search Window when assigning an Animator Controller in the Animator Component
- Unity Version Control server textfield’s text overlaps with the dropdown triangle button in the Explore repositories window when an organization with a long name is selected
RobAtApex
Apr 27, 2022 09:22
Can still replicate in 2020.1.2. It's a terrible bug that takes much time to track down after ruling out many other lighting issues.
How can they say this is "by design" and resolved with no explanation?
If you use LoadImage with a PNG, it comes in darker than the actual image in the file. That's a bug.
Nokola
Dec 27, 2019 06:39
I just hit the same issue - in my case a paint app that can't load a PNG file correctly because of this problem.
To reproduce:
1. In Paint.net create file and fill with gray 50,50,50
2. In Unity open with LoadImage
Expected: values in texture are RGB 50,50,50
Actual: values in texture are RGB 42,42,42
Obviously a horrible bug.
sam-rae
Jun 19, 2019 08:47
"By Design"?
Am I being dense or should PNGs load with the colours that were actually in the file?