Atari ST palette bug

45 views
Skip to first unread message

Anders Eriksson

unread,
May 23, 2020, 6:40:04 AM5/23/20
to gra...@googlegroups.com
Hello,

first and foremost thanks for a great tool. It has become a daily
workhorse for me.

And now down to a little bug a guy reported on the #atariscne IRC
channel last night: Saving Atari ST PI1 files results in (sort of) Atari
STe palette values.

So I decided to test it myself, and yes he was right.

Grafx2 version: 2.7.2978
Grafx2.app-x86_64-sdl2-2.7.2978.zip
OS: macOS Mojave 10.14


Method:

1. Create a 320x200 image
2. Set palette to 8 RGB-levels (divide five times)
3. Create a greyscale fade of 8 colours
4. Save as Degas Elite PI1

Normally that would look like:
$0000,$0111,$0222,$0333,$0444,$0555,$0666,$0777

GrafX2 outputs:
$0000,$0111,$0222,$0333,$0CCC,$0DDD,$0EEE,$0FFF

As I read that, RGB values above 3 gets the STe treatment (most
siginificant bit is set). This bit is ignored on ST machines but on STe
machines the image will look slightly different than intended.

The same issue resides with NEO images and I guess PC1 files (untested).


Also did a test with 16 RGB-levels (divide four times) with a 16 colour
greyscale saved as PI1 (STe colours) which came out correct.

$0000,$0888,$0111,$0999,$0222,$0AAA,$0333,$0BBB
$0444,$0CCC,$0555,$0DDD,$0666,$0EEE,$0777,$0FFF


--
Anders Eriksson
a...@dhs.nu

miniupnp

unread,
May 23, 2020, 12:08:24 PM5/23/20
to gra...@googlegroups.com
Le 23/05/2020 à 12:24, Anders Eriksson a écrit :
Hello,

first and foremost thanks for a great tool. It has become a daily workhorse for me.

And now down to a little bug a guy reported on the #atariscne IRC channel last night: Saving Atari ST PI1 files results in (sort of) Atari STe palette values.

So I decided to test it myself, and yes he was right.

Grafx2 version: 2.7.2978
Grafx2.app-x86_64-sdl2-2.7.2978.zip
OS: macOS Mojave 10.14


Method:

1. Create a 320x200 image
2. Set palette to 8 RGB-levels (divide five times)
3. Create a greyscale fade of 8 colours
4. Save as Degas Elite PI1

Normally that would look like:
$0000,$0111,$0222,$0333,$0444,$0555,$0666,$0777

GrafX2 outputs:
$0000,$0111,$0222,$0333,$0CCC,$0DDD,$0EEE,$0FFF

well it is correct, and you'll get the same result with all ST formats.

$0,$1,$2,$3,$C,$D,$E,$F
translate to levels
0,2,4,6,9,11,13,15 on STe (0 to 15)
0,1,2,3,4,5,6,7 on ST (0 to 7)

That is the correct division in 8 levels of values from 0 to 7 and from 0 to 15.
Max is 15 on a STe, not 14. (white is 15,15,15)

If you want to get levels 0 2 4 6 8 10 12 14 on STe to use "plain ST colors", just set the RGB Scale to 16
and make your shades using the value "14" as maximum. All components must have an even value, as odd values are "STe only".



Regards,

Thomas

evl...@gmail.com

unread,
May 23, 2020, 5:19:38 PM5/23/20
to GrafX2
Den lördag 23 maj 2020 kl. 18:08:24 UTC+2 skrev miniupnp:
Le 23/05/2020 à 12:24, Anders Eriksson a écrit :

Normally that would look like:
$0000,$0111,$0222,$0333,$0444,$0555,$0666,$0777

GrafX2 outputs:
$0000,$0111,$0222,$0333,$0CCC,$0DDD,$0EEE,$0FFF

well it is correct, and you'll get the same result with all ST formats.

$0,$1,$2,$3,$C,$D,$E,$F
translate to levels
0,2,4,6,9,11,13,15 on STe (0 to 15)
0,1,2,3,4,5,6,7 on ST (0 to 7)

That is the correct division in 8 levels of values from 0 to 7 and from 0 to 15.
Max is 15 on a STe, not 14. (white is 15,15,15)

If you want to get levels 0 2 4 6 8 10 12 14 on STe to use "plain ST colors", just set the RGB Scale to 16
and make your shades using the value "14" as maximum. All components must have an even value, as odd values are "STe only".

Hello,

thanks for your reply.

Take any ST tool (Degas, Crackart, Neochrome...) and create an 8-step (ST) grey scale.
The palette in the file will be 0,1,2,3,4,5,6,7. Even if you work in the same 8-step mode Grafx2 will not save the same.

I understand that this "upscale" is by design, but it will unfortunately create incompatible files.

The solution to export proper ST-files seems pretty easy though; if RGB-levels are smaller or equal 8, strip msb, otherwise keep it.


Example of a workflow if you want an ST-compatible palette now:

a) Save a 320x200 gif from Gimp or whatever
b) Load into Grafx2, reduce colours to 16
c) Change palette to 16-steps
d) Manually edit each colour component (48 in total) in the palette so it doesn't use uneven numbers
e) Save PI1

The graphics artists will not be happy being told to do this ;-)

--
Anders Eriksson

miniupnp

unread,
May 24, 2020, 2:13:27 PM5/24/20
to gra...@googlegroups.com, evl...@gmail.com
So you suggest we remove the STe palette support ?

I think we could rather add a configuration flag "use only plain ST colors (8 levels) while saving"

Or I think one could use a lua script to convert any palette to the ST colors.
I will have a look.
--

---
You received this message because you are subscribed to the Google Groups "GrafX2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grafx2+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grafx2/62a5e2b1-326a-4c38-8a55-b6911ba0929d%40googlegroups.com.

evl...@gmail.com

unread,
May 24, 2020, 2:49:06 PM5/24/20
to GrafX2
Den söndag 24 maj 2020 kl. 20:13:27 UTC+2 skrev miniupnp:

Hi!

So you suggest we remove the STe palette support ?


Not at all :)

If RGB-levels is set to 8, at least I (and a few other on the IRC channel) interpreters that as ST-compatible, especially when saving in an ST format such as PI1.
For 16 levels, the STe bit need to be set, naturally.

That's how it works with native Atari software. Neochrome Master is a good example. It will show you RGB levels 0-7, and save 0-7.  When you enable STe palette option, then the selection is increased to 16 levels and the files are saved with the extra bit.


However, if this is not how Grafx2 is supposed to work, I understand. It's just a pity that this awesome tool is 99% there for ST-artists, just one important detail that's not quite correct :)

--
Anders Eriksson
To unsubscribe from this group and stop receiving emails from it, send an email to gra...@googlegroups.com.

miniupnp

unread,
May 24, 2020, 5:39:26 PM5/24/20
to gra...@googlegroups.com, evl...@gmail.com
Hello,

Just run the attached lua script to convert the 16 first colors of the palette to a ST only palette before saving.
it must be run with RGB scale set to 256 (default) or 16 (STe setting)
You can assign it to a keyboard shortcut.

Regards,

Thomas
to_3bit_ST_pal.lua

miniupnp

unread,
May 25, 2020, 4:10:32 PM5/25/20
to gra...@googlegroups.com, evl...@gmail.com
Hello,

I implemented that when RGB-levels is set to 8, only 3 bits per component are saved in the ST formats palette.

I think that is exactly what you want. Save a STe palette when RGB-levels are 16, save a ST palette when RGB-levers are set to 8.

See the Merge request :
https://gitlab.com/GrafX2/grafX2/-/merge_requests/287

You can get a build by browsing the jobs "artifacts" :
https://gitlab.com/miniupnp/grafX2/-/jobs/566834777 (win32)
but you also get the atari version :
https://gitlab.com/miniupnp/grafX2/-/jobs/566834778

;)

Thomas

stay /|\
--

---
You received this message because you are subscribed to the Google Groups "GrafX2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grafx2+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grafx2/b151642f-fc38-8189-ec19-4e3923dbbb14%40free.fr.

evl...@gmail.com

unread,
May 26, 2020, 12:28:58 PM5/26/20
to GrafX2
Hi Thomas!

I've tried the updated version and it saves out real ST-colours in PI1-files if set to 8-step mode.

Excellent work, thanks a lot :-)

--
Anders Eriksson
To unsubscribe from this group and stop receiving emails from it, send an email to gra...@googlegroups.com.

miniupnp

unread,
May 27, 2020, 7:12:30 AM5/27/20
to gra...@googlegroups.com, evl...@gmail.com
OK, the patch was merged into the master branch.
So it is now included in the "nightly builds"

Regards,

Thomas


Le 26/05/2020 à 18:28, evl...@gmail.com a écrit :
Reply all
Reply to author
Forward
0 new messages