andrew-raphael-lukasik / pngcs Goto Github PK
View Code? Open in Web Editor NEWThis project forked from leonbloy/pngcs
PNG encoding and decoding for Unity engine
This project forked from leonbloy/pngcs
PNG encoding and decoding for Unity engine
There seems so be quite a lot of garbage being created when using these calls.
My use case.
I export 7 Large PNG's in succession or in parallel with async.
When I run the same process again the Mobile Version crashes due to memory issues.
This suggests that something is not properly discarded. Will run through code and see if I have any suggestions.
I tried the following code and got this error.
IndexOutOfRangeException: Index was outside the bounds of the array.
Pngcs.PngWriter.EncodeRowFromInt (System.Int32[] row) (at Assets/pngcs-master/Pngcs/PngWriter.cs:270)
Pngcs.PngWriter.WriteRowInt (System.Int32[] newrow, System.Int32 rown) (at Assets/pngcs-master/Pngcs/PngWriter.cs:549)
Pngcs.PngWriter.WriteRow (Pngcs.ImageLine line, System.Int32 rownumber) (at Assets/pngcs-master/Pngcs/PngWriter.cs:530)
Pngcs.Unity.PNG.Write (UnityEngine.Color[] pixels, System.Int32 width, System.Int32 height, System.Int32 bitDepth, System.Boolean alpha, System.Boolean greyscale, System.String filePath) (at Assets/pngcs-master/Pngcs/Unity/Unity.cs:238)
Pngcs.Unity.PNG.Write (UnityEngine.Texture2D texture, System.String filePath) (at Assets/pngcs-master/Pngcs/Unity/Unity.cs:152)
PngcsTest+d__0.MoveNext () (at Assets/pngcs-master/PngcsTest.cs:15)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
IEnumerator Start()
{
yield return new WaitForEndOfFrame();
var texture = ScreenCapture.CaptureScreenshotAsTexture();
var output = Path.Combine(Application.persistentDataPath, "test.png");
PNG.Write(texture, output);
}
No (easy) support for indexed color format in PNG class so far.
Pull requests are welcome!
This is caused by actually really silly mistake on my part. I will fix it today
Originally posted by @ddutchie in #2 (comment)
You may want to stay away from async calls until this is solved. Because these methods sometimes return null. Any info and repro steps on this will be highly appreciated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.