Page 1 of 2

Can we fix Thargoid Carriers?

Posted: Sun Mar 22, 2026 3:24 am
by UK_Eliter
Dear all

There seems to be a bug in the old Thargoid Carriers OXP, whereby occasionally the carrier ships are near-invisible. When that happens I fear my computer is playing up. But I think the cause has to do with this message in the log:

Code: Select all

[texture.load.png.error]: ***** A PNG loading error occurred for ../AddOns/thargoid_carrier2.0.oxp/Textures/thargoid-carrier.png: bad adaptive filter value.
Does anyone know how to fix the problem?

The wiki, which I linked, gives this authorship: 'Original author: Selezen, rejigged by ADCK[;] this version is by Commander McLane (2012)'. The OXP lacks a manifest file, but within its 'thargoid-carrier-script.js', I found this:
thargoid_carrier.oxp
Copyright © 2006-2012 "Selezen", scripting by "Commander McLane"

This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.
So we can modify the OXP and distribute the result. But is the esteemed Command McLane still around? I seem to half-remember that he is not, but I have not been able to dig anything up, except that the board marks him as last active in January 2024. At any rate, we'll need to know how to fix the problem, and I myself do not.

Re: Can we fix Thargoid Carriers?

Posted: Sun Mar 22, 2026 3:49 am
by phkb
UK_Eliter wrote: Sun Mar 22, 2026 3:24 am
At any rate, we'll need to know how to fix the problem, and I myself do not.
The easiest fix I've found:
1. Open the image in any image editor
2. Copy the image
3. Create a new image file and paste in the image previously copied.
4. Save the new image over the top of the previous one (making sure you keep the file name and image dimensions the same).

Re: Can we fix Thargoid Carriers?

Posted: Sun Mar 22, 2026 2:55 pm
by MrFlibble
I've taken the liberty of preening that oxp a little bit.

I used a python script to fix the pngs. Hidden here for brevity.
Spoiler

Code: Select all

from PIL import Image
im = Image.open('thargoid-carrier-dock.png')
im.save('output/thargoid-carrier-dock.png')
im = Image.open('thargoid-carrier.png')
im.save('output/thargoid-carrier.png')
..crude, but effective.
So here's proposed 2.1.
Fixed pngs, removed Mac hidden files, bumped version to 2.1, tidied readme. Otherwise, the same.
Edit: For final upload version, I should probably put the readME.rtf INSIDE the oxp folder.

Thargoid_carrier2.1.zip

For testing, watch Latest.log and use this in debug console:

Code: Select all

:spawn thargoid_carrier
With 2.0 of the oxp the error will appear in log. With my proposed 2.1 it's gone.
I'll knit that into the appropriate wiki page if and when approved by a superior officer.

Side note: The upload form on the wiki has a pull-down for license type, but no options exist.

Re: Can we fix Thargoid Carriers?

Posted: Sun Mar 22, 2026 3:04 pm
by UK_Eliter
Good stuff.

When I opened the file in my editor - 'GIMP' - the editor asked whether I wished to keep the file's colour profile. I said 'yes', but steps 2-4 will remove that profile, I think; and probably the profile is the problem. When I saved the file as PNG, GIMP asked me about compression and related matters; I accepted the defaults. Then I ran Oolite and the log message was gone - but I have not yet, post-patch, encountered a carrier yet.

I notice that the Imperial Courier OXP causes the same type of error message, viz.,

Code: Select all

 PNG loading error occurred for ../AddOns/impcourier2.oxp/Textures/imp_cour_tex.png: bad adaptive filter value.
Perhaps someone needs to adopt these two OXPs and upload fixed versions - complete with manifest files - to the central repository. I could do it, but not for a while. But, ah: MrFlibbe has beaten me to it. Well done, that commander!

Re: Can we fix Thargoid Carriers?

Posted: Sun Mar 22, 2026 3:14 pm
by MrFlibble
Thanks. I've fixed that file structure a bit just now.

Will consider doing manifest, oxz format etc. in due course.

Imperial Courier should be easy enough to fix, and I may use that as a template to get my head round the manifest stuff.

Edit: These are popping up in various other places (e.g. oolite.oxp.DrNil.YAH-SetB.oxz/Textures/yah_set_B_griff_station_adring.png). I'll try to conjure a script to identify them.

Re: Can we fix Thargoid Carriers?

Posted: Sun Mar 22, 2026 6:07 pm
by Cholmondely
MrFlibble wrote: Sun Mar 22, 2026 3:14 pm
Thanks. I've fixed that file structure a bit just now.

Will consider doing manifest, oxz format etc. in due course.

Imperial Courier should be easy enough to fix, and I may use that as a template to get my head round the manifest stuff.

Edit: These are popping up in various other places (e.g. oolite.oxp.DrNil.YAH-SetB.oxz/Textures/yah_set_B_griff_station_adring.png). I'll try to conjure a script to identify them.
Thanking you, Mr F!

Re: Can we fix Thargoid Carriers?

Posted: Sun Mar 22, 2026 9:41 pm
by phkb
MrFlibble wrote: Sun Mar 22, 2026 3:14 pm
Edit: These are popping up in various other places (e.g. oolite.oxp.DrNil.YAH-SetB.oxz/Textures/yah_set_B_griff_station_adring.png). I'll try to conjure a script to identify them.
I thought I fixed the YAH packs. Is that in the latest version?

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 12:24 am
by MrFlibble
phkb wrote: Sun Mar 22, 2026 9:41 pm
MrFlibble wrote: Sun Mar 22, 2026 3:14 pm
Edit: These are popping up in various other places (e.g. oolite.oxp.DrNil.YAH-SetB.oxz/Textures/yah_set_B_griff_station_adring.png). I'll try to conjure a script to identify them.
I thought I fixed the YAH packs. Is that in the latest version?
Perhaps not. There's an update available (4.5-4.6) here on my recently demoted daily-driver which I may paid less attention to on less living-room intensive days. In defence, I was between checking Imperial courier (for which invoking neither ic-pirate nor ic-navy seemed to cause the issue), and going out for a wee dram down the local... of which the latter seized most attention due to peer and partner pressure.

Edit: obviously helpful if you can provide a debug console stanza to invoke the potential issue in YAH., however, finding a way to test png files for the issue in the first place may obviate that, as I already wrote a loop/test/fix script for a similar issue.

I'll have a fumble at finding a way to test for these on the sunny side.

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 6:32 am
by hiran
MrFlibble wrote: Sun Mar 22, 2026 3:14 pm
Imperial Courier should be easy enough to fix, and I may use that as a template to get my head round the manifest stuff.
Oh, is that the reason why the Imperial Courier I was flying always looked a perfect white on outside views? I never wasted a thought about it...
:-D

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 6:34 am
by hiran
phkb wrote: Sun Mar 22, 2026 9:41 pm
MrFlibble wrote: Sun Mar 22, 2026 3:14 pm
Edit: These are popping up in various other places (e.g. oolite.oxp.DrNil.YAH-SetB.oxz/Textures/yah_set_B_griff_station_adring.png). I'll try to conjure a script to identify them.
I thought I fixed the YAH packs. Is that in the latest version?
We could scan all OXPs in the expansion catalog for faulty images. Suppose there is one on my harddrive - how would I identify if it's faulty or ok?

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 12:52 pm
by MrFlibble
hiran wrote: Mon Mar 23, 2026 6:34 am
We could scan all OXPs in the expansion catalog for faulty images. Suppose there is one on my harddrive - how would I identify if it's faulty or ok?
That's what I hope to establish, Ideally today. I hope to be able to use a method like the one I offered to solve the other png file problem a while back, in a distant thread. This one may me a tad harder to pin down, since none of the tools I've thrown at it so far have complained. If anyone knows the specifics of how this gets tripped by Oolite, they may be able to save me some sweat.

Alternatively, Oolite could be made more resilient to this and the other issue, to remove the need to fix everything else. Both png issues so far are ones which not much else has trouble with.

Edit: Found a much earlier thread that touches on this /viewtopic.php?t=14832 but alas, the solution there was a brutal re-render of every png regardless, without detecting whether they were faulty first.

Edit2: https://github.com/saucecontrol/PhotoSauce/issues/139 may hint at how to achieve resilience to such errors. I've so far tried pngfix, pngcheck, identify, and a few other script-able tools, but still nothing seems to be upset by the images in thargoid_carrier2.0.zip

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 1:42 pm
by hiran
The whole thing relates to an invalid iccp profile, caused by how libpng and SDL work together.

And it seems removing that profile is one possible fix.
https://stackoverflow.com/questions/227 ... gb-profile

So a first investigation could simply print the color profiles until we learn which is the bad one or simply mogrify them out completely.

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 2:25 pm
by MrFlibble
hiran wrote: Mon Mar 23, 2026 1:42 pm
The whole thing relates to an invalid iccp profile, caused by how libpng and SDL work together.

And it seems removing that profile is one possible fix.
https://stackoverflow.com/questions/227 ... gb-profile

So a first investigation could simply print the color profiles until we learn which is the bad one or simply mogrify them out completely.
I was under the impression that the top topic in this thread was a bad row error. Either way, I brow-beat ChatGPT to spew out a C program to use libpng to dig deep to find errors in png files, and still no hit on the png files from thargoid_carrier2.0.

Perhaps someone here would be kind enough to distil the relevant code from Oolite to build a simple png file checker which would show issues largely specific to Oolite. An Oolite png lint if you will. Such a tool would be light enough to run from a shell script in a loop and could even be included in the dev and test branches for OXP devs convenience.

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 2:41 pm
by MrFlibble
One notable difference between the failed and fixed files, is that the initial version has one IDAT chunk of length 227815, where the fixed file uses three chunks of 65536 or less.

The initial file is also interlaced, where the fixed is not.

Might be red herrings.

Re: Can we fix Thargoid Carriers?

Posted: Mon Mar 23, 2026 5:18 pm
by hiran
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.