Page 1 of 1

gpl2jascpal

Posted: May 21st, 2011, 1:24 pm
by Norbert
I have just finished and released the first version (Linux version [Edit: + Windows version]) of gpl2jascpal. This utility converts GIMP gpl palettes to JASC pal palettes. GIMP can already import JASC pal palettes, but it can not yet export palettes to the JASC pal format. PoP1 pal files can now be imported into GIMP, exported as GIMP gpl palettes, and then converted back to JASC pal palettes with this utility.

It is currently only available for GNU/Linux.
David or someone else might port it to Windows at some point.

I will soon publish documentation that explains how to import and export images with PR, and how palettes can be changed using GIMP (and this gpl2jascpal utility).
(I know that Paint Shop Pro can edit JASC pal palettes, but I use GIMP on my GNU/Linux machine. GIMP is also available for Windows and Mac OS X.)

Re: gpl2jascpal

Posted: May 24th, 2011, 11:39 am
by David
I've ported it to Windows.
Link: http://www.freeweb.hu/princepersia/en/g ... l01_dl.htm

Please note that I haven't tested it, because I don't have .gpl files.

Re: gpl2jascpal

Posted: May 24th, 2011, 4:48 pm
by Norbert
Hey, thanks for taking a look at it. :)

Here are some sample .gpl files (three mirrors, each has the same .zip):
http://www.mediafire.com/?1g7wnd8707m6ozb
http://www.megaupload.com/?d=9FKHU06K
http://www.sendspace.com/file/ayn1me

The Windows version appears to create .pal files which have lines that end with:
0D 0D 0A (\r\r\n).
This should be 0D 0A (\r\n).

Apparently the write function under Windows already adds the \r by itself.
So, \r should be removed from the code everywhere.
(On lines 258, 260, 262 and 266.)

Re: gpl2jascpal

Posted: May 28th, 2011, 2:45 pm
by David
Norbert wrote:So, \r should be removed from the code everywhere.
Another solution is to add |O_BINARY to the flags in the call to the open function.
I also used O_BINARY when porting Apoplexy to Windows.

I've fixed the bug using the latter way.
Link: http://www.freeweb.hu/princepersia/en/g ... l01_dl.htm

Re: gpl2jascpal

Posted: May 28th, 2011, 3:47 pm
by Norbert
Thanks.

Re: gpl2jascpal

Posted: May 28th, 2014, 5:42 pm
by zsoltfarago
Hello!
I have a problem with gpl2jascpal: I don't know how to use it. Could you send me a description about it? (I know, I'm very bad in things like this, but this is the only obstacle between my mod and me :D)

Re: gpl2jascpal

Posted: May 29th, 2014, 2:17 pm
by David
You need to run it from the command line, and pass the path/name of the .gpl file as a command line parameter.
The converted palette is written into a new file with .pal extension.

Re: gpl2jascpal

Posted: May 29th, 2014, 4:41 pm
by Norbert
If you're on Windows, make sure you're using the Windows version.
Additional information about using gpl2jascpal can be found in this document, although that document is somewhat Linux-oriented.

The easiest thing to do when changing images of PoP for DOS is to not change palettes.
Get GIMP (Windows version here) and only use the Colormap (see "5. Using The Colormap" in the document mentioned above).
If you don't touch any palettes, changing images is a lot easier.

Re: gpl2jascpal

Posted: May 31st, 2014, 11:57 am
by zsoltfarago
Thank you! :)

Re: gpl2jascpal

Posted: December 16th, 2017, 2:19 pm
by Norbert
Okay, it looks like this tool only works for customly saved .gpl palettes, because these have a tab+name after the blue color.

Old content of this post:
Spoiler: show
I think I just discovered a major bug in this program.
On line 208,
for (iTemp = 0; iTemp < strlen (sLine); iTemp++)
should be
for (iTemp = 0; iTemp <= strlen (sLine); iTemp++)
And as a result the blue value is always 0 or random.

So now I don't get how this program ever worked for me (e.g. Prince of Wateria) and others.
Looking into this...
Maybe GIMP changed the .gpl newline endings from \r\n to \n.

Re: gpl2jascpal

Posted: December 16th, 2017, 3:27 pm
by Norbert
Norbert wrote: December 16th, 2017, 2:19 pmOkay, it looks like this tool only works for customly saved .gpl palettes, because these have a tab+name after the blue color.
I just checked whether GIMP's default (non-custom) palettes used to also have tab+name after the blue color back in the day.
(By installing GIMP 2.6.9 for Windows with Wine.)
And they did!

Code: Select all

norbert@stimpy ~ $ cat /home/norbert/.wine/drive_c/Program\ Files\ \(x86\)/GIMP-2.0/share/gimp/2.0/palettes/Web.gpl |tail -n 1
  0   0   0     Untitled
So what has changed is that they no longer do:

Code: Select all

norbert@stimpy ~ $ cat /usr/share/gimp/2.0/palettes/Web.gpl |tail -n 1
  0   0   0
This means I could update the gpl2jascpal tool to properly process the new default (non-custom) palettes.

Re: gpl2jascpal

Posted: December 26th, 2017, 11:40 am
by Norbert
Norbert wrote: December 16th, 2017, 3:27 pmThis means I could update the gpl2jascpal tool to properly process the new default (non-custom) palettes.
Here's the new release (v0.2): for Windows (mirror) and for GNU/Linux (mirror).

This version changes:

Code: Select all

+ Now also processes, with a warning, input palettes that have neither 16 (4 bit) nor 256 (8 bit) colors.
* Nowadays, GIMP's predefined gpl palettes no longer include "Untitled" color names, making these names optional. Fixed gpl2jascpal accordingly.

Re: gpl2jascpal

Posted: October 14th, 2019, 12:41 am
by Emiliano
I didn't need to use this program I can translate RGB numbers to colors and vice versa
Anyway thanks for this program ;)