pngcs icon indicating copy to clipboard operation
pngcs copied to clipboard

API Async methods sometimes fail to return texture object

Open andrew-raphael-lukasik opened this issue 5 years ago • 6 comments

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

andrew-raphael-lukasik avatar Apr 03 '19 12:04 andrew-raphael-lukasik

Async Saving does not work for me

texture.isReadable is only available on main thread texture GetDataWidth also.

Keen to see where this goes. Having issues saving massive textures on mobile.

ddutchie avatar Apr 05 '19 10:04 ddutchie

Thanks @ddutchie for reporting this. Fortunately it's really easy to fix and caused by just silly mistake on my part I didn't pickup earlier. Well and it shows why unit testing is a really good idea for these kind of projects.

andrew-raphael-lukasik avatar Apr 09 '19 07:04 andrew-raphael-lukasik

Also having this issue. Did async calls ever work?

aidanwolf avatar Jul 21 '19 21:07 aidanwolf

According to my tests, Read/Write with pngcs are 1.6x slower than using Unity's EncodeToPNG() and LoadImage().

aidanwolf avatar Jul 21 '19 22:07 aidanwolf

Hi @aidanwolf. PNGCS is slower because it's designed for "huge images, which one does not want to load fully in memory" (original readme.txt), ie. memory conservation rather than speed. PNGCS realises this goal reading images line by line, and decoding data line by line. But this behaviour can be modified to regain speed

andrew-raphael-lukasik avatar Aug 07 '19 09:08 andrew-raphael-lukasik

Also having this issue. Did async calls ever work?

Yes BUT there is a bug somewhere and I can't figure out what it is exactly. I can reproduce it always happening on 1st program execution after editor is (re)started and works fine after that. I tried to figure out what is happening on several occasion but no results so far. I even contacted Unity support with this issue but yet to receive answer from them. If you guys happen to notice any code-smell or have any leads for this issue please let me know!

andrew-raphael-lukasik avatar Aug 07 '19 09:08 andrew-raphael-lukasik