Page 2 of 2

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 5:52 pm
by MrFlibble
hiran wrote: Mon Mar 23, 2026 5:18 pm
Maybe this is our test:
https://stackoverflow.com/questions/22745076/libpng-warning-iccp-known-incorrect-srgb-profile wrote:
If you'd like to find out which files need to be fixed instead of blindly processing all of them, you can run

Code: Select all

pngcrush -n -q *.png
where the -n means don't rewrite the files and -q means suppress most of the output except for warnings. Sorry, there's no option yet in pngcrush to suppress everything but the warnings.

Note: You must have pngcrush installed.
I'd already tried pngcrush, but alas, it doesn't show an issue. Though I should have used it to optimise my fixed files, and will if and when I package as oxz.

Code: Select all

$ for i in thargoid-carrier.png fixed-thargoid-carrier.png thargoid-carrier-dock.png fixed-thargoid-carrier-dock.png ; do pngcrush -n -q "$i" ; echo $? ; done 2>&1 | grep -v ^CPU

  thargoid-carrier.png:
   Total length of data found in critical chunks            =    227872
0
  fixed-thargoid-carrier.png:
   Total length of data found in critical chunks            =    179433
0
  thargoid-carrier-dock.png:
   Total length of data found in critical chunks            =     42319
0
  fixed-thargoid-carrier-dock.png:
   Total length of data found in critical chunks            =     43674
0

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 6:14 pm
by cbr
in my own experience the error doesnot seem to activate everytime. Why the error persists more recently i do not know. :cry: :?:

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 6:24 pm
by MrFlibble
cbr wrote: Mon Mar 23, 2026 6:14 pm
in my own experience the error doesnot seem to activate everytime. Why the error persists more recently i do not know. :cry: :?:
Do you have logs of the issue showing it from different files?

Else, if just the one from OP then it can be invoked via debug console as I described above.

Re: Can we fix Thargoid Carriers?

Posted: Tue Mar 24, 2026 1:03 pm
by MrFlibble
Right... I think I've found at least one cause of "png: bad adaptive filter value."

Interlaced mode, either line or plane.

Using my unoptimised but working (thargoid_carrier2.1.oxp/Textures/thargoid-carrier.png) as a basis. I made several new versions in a subdirectory, and tested with debug console, changing symlinks between launches.

Code: Select all

mkdir sub
mv thargoid-carrier.png  sub/thargoid-carrier.21.png
cd sub
convert -interlace line thargoid-carrier.21.png  thargoid-carrier.int-line.png
convert -interlace plane thargoid-carrier.21.png  thargoid-carrier.int-plane.png 
pngcrush thargoid-carrier.int-line.png thargoid-carrier.opt-int-line.png
pngcrush thargoid-carrier.int-plane.png thargoid-carrier.opt-int-plane.png
pngcrush thargoid-carrier.21.png thargoid-carrier.opt.png

$ ls -1s *.png
176 thargoid-carrier.21.png
224 thargoid-carrier.int-line.png
224 thargoid-carrier.int-plane.png
196 thargoid-carrier.opt-int-line.png
196 thargoid-carrier.opt-int-plane.png
164 thargoid-carrier.opt.png

$ pngcheck *.png
OK: thargoid-carrier.21.png (512x512, 24-bit RGB, non-interlaced, static, 77.2%).
OK: thargoid-carrier.int-line.png (512x512, 24-bit RGB, interlaced, static, 70.9%).
OK: thargoid-carrier.int-plane.png (512x512, 24-bit RGB, interlaced, static, 70.9%).
OK: thargoid-carrier.opt-int-line.png (512x512, 24-bit RGB, interlaced, static, 74.7%).
OK: thargoid-carrier.opt-int-plane.png (512x512, 24-bit RGB, interlaced, static, 74.7%).
OK: thargoid-carrier.opt.png (512x512, 24-bit RGB, non-interlaced, static, 78.7%).

No errors were detected in 6 of the 6 files tested.

# We can see that all the 'int' files are interlaced mode.
# Go back to the textures directory

cd ..

# then between tests.
ln -sf sub/$whichever thargoid-carrier.png
Running oolite, launching and then in debug console using ":spawn thargoid_carrier", all the interlaced files caused the error and robbed the texture. The rest were fine.

I'll run a loop in a minute to find out which of my plethora of oxp/z have interlaced png textures, and test a few more of them where they can be trivially invoked. If there are enough, might it be worth getting Oolite to handle interlaced png files rather than trying to 'fix' them all?

Bonus. When optimised with pngcrush, if not interlaced, will be smaller file.

OT: Testing on this two screen setup it becomes very apparent that the game, when focused, regardless of windowed or fullscreen mode, sets gamma across the whole desktop, both screens, rather than just in the game window. Mildly irritating, as the second screen, with debug/terminals/browser, gets noticeably brighter.

Re: Can we fix Thargoid Carriers?

Posted: Tue Mar 24, 2026 2:40 pm
by MrFlibble
Here's the brutal way I've detected interlaced PNGs among my expansions collection. Also found one with actual errors, probably benign.

Do not use this code if you don't know your bash from your csh.

I wrote these for inspection overview, not for automation.

For a directory containing OXP's as folders:

Code: Select all

# cd to a directory containing OXP's (e.g. $HOME/Oolite/GameData/AddOns, then 

find . -type d -iname \*.oxp | while read d ; do
  echo "$d" && cd "$d" && find -type f -iname \*.png -exec pngcheck "{}" \; |  grep -v '^OK: .* non-interlaced' && cd - >/dev/null 2>&1
done
For a directory containing OXZ's as zip archives with oxz suffixes:

Code: Select all

# cd to a directory containing OXZ's (e.g. $HOME/Oolite/GameData/.ManagedAddOns, then 

find -type f | grep '\.oxz$' | sed 's@^\./@@' |  while read ; do
  t=$(mktemp -d)
  [ "x$t" = "x" ] && { echo "fail due to mktemp error" ; break ; }
  echo $REPLY
  unzip -qq "$REPLY" *.png -x *__MACOS* -d "$t/$REPLY"
  find "$t" -type f  -exec pngcheck "{}" \; | grep -v '^OK: .* non-interlaced' | sed "s@^OK: $t/$REPLY/@@"
  rm -rf "$t"
done
The latter script will give output like:

Code: Select all

oolite.oxp.phkb.LinersMarkets.oxz
caution: filename not matched:  *.png
caution: excluded filename not matched:  *__MACOS*
oolite.oxp.Svengali.Library.oxz
Textures/lib_starmap_6.png (128x128, 32-bit RGB+alpha, interlaced, static, -0.7%).
The first of those indicates that the oxz contains no png files.
The second means the archive contained superflous apple cruft, where hidden files with png suffix that aren't actually png files will cause us headaches in these tests.
The third is a hit.

Obviously if you have a directory with both types, run both testers.

The output is messy, but fairlyeasily interpreted. Here are preened versions of the ones I found:

Anyone got an easy way to invoke these?

Code: Select all

oolite.oxp.EricWalch.DeepSpaceDredger.oxz/Textures/dredgerTraderEngines_emission.png (1024x1024, 8-bit grayscale, interlaced, static, 95.6%).
oolite.oxp.Svengali.Library.oxz/Textures/lib_starmap_6.png (128x128, 32-bit RGB+alpha, interlaced, static, -0.7%).
There's a ton of different png types in that last one!

Not sure if this one matters. The texture is so subtle, I'm not sure if it renders or not. I'll fire up and check if it spits errors into log presently.

Code: Select all

oolite.oxp.Norby.Towbar.oxz/Textures/towbar.png  tEXt text contains NULL character(s)
ERROR: oolite.oxp.Norby.Towbar.oxz/Textures/towbar.png
Even though there are very few listed here, I don't have *all" the OX[PZ]s available, so IMHO, fixing Oolite to handle interlaced PNG files properly is the best way to go.

Edit: Addendum: Some of the build-in PNGs appear to have 'issues'. This is using the current 1.92.1 appimage.

Code: Select all

$ grep -i png Latest.log  | grep -iE "warn|err" | sed 's/^.*\]: -----//' | sort | uniq
 A PNG loading warning occurred for /tmp/.mount_ooliteknLhFe/usr/bin/Resources/Textures/oolite_buoy_diffuse.png: iCCP: cHRM chunk does not match sRGB.
 A PNG loading warning occurred for /tmp/.mount_ooliteknLhFe/usr/bin/Resources/Textures/oolite_buoy_diffuse.png: iCCP: known incorrect sRGB profile.
 A PNG loading warning occurred for /tmp/.mount_ooliteknLhFe/usr/bin/Resources/Textures/oolite_buoy_illumination.png: iCCP: cHRM chunk does not match sRGB.
 A PNG loading warning occurred for /tmp/.mount_ooliteknLhFe/usr/bin/Resources/Textures/oolite_buoy_illumination.png: iCCP: known incorrect sRGB profile.