TTDViewer [2010-03-14]

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: TTDViewer [2010-03-14]

Post by Emperor Jake »

frosch wrote: Hmmm... if this is true then I must have done this on thousands of files... Geeeeeee...

One more thing is that I don't see any of this "full-color"/"old-school" options in MsPaint and when I use "Save as .png" there are no options there either. Is it possible that it also depends on the palette that I use? I've realized that I've used one (I think DOS) version during my early drawings while I've switched to the more-colored Windows version in the later works. Is it possible that affects the issue too?
Yes, probably. :P The thing is, MSPaint doesn't support palletising images, it is only able to keep the palette that an image already has. You need something like GIMP or Photoshop to actually convert an image to 8bpp, which you can do in large batches at once using macros, I think so don't worry about that. Also, the DOS palette is the one you want to use, it actually has more colours than the Windows palette, which only exists in OpenTTD as legacy support for older GRFs and the files from the Windows 95 version of TTD.
User avatar
Voyager One
Tycoon
Tycoon
Posts: 11204
Joined: 28 Dec 2009 09:47
Location: Rijeka, Croatia

Re: TTDViewer [2010-03-14]

Post by Voyager One »

Emperor Jake wrote:also, the DOS palette is the one you want to use, it actually has more colours than the Windows palette
A-ha, typo from before. I've first used the WINDOWS palette (and it seem that this one is causing trouble in my files) and later switched to the DOS palette.


EDIT: This is weird. I've tried opening two files that have the Windows palette and TTDViewer opens easily one of them (locomotive) while says "no indexed image" for the other one (wagon). What's the difference? They're both quite the same... :?

The thing is that TTDViewer doesn't want to open any of my wagon's files while it opens locomotive's files normally... weird...

I've attached these two examples below, can someone take a look and possibly discover what's the problem please.
Attachments
IC.PNG
IC.PNG (19.25 KiB) Viewed 2676 times
RZD VL41.PNG
RZD VL41.PNG (6.91 KiB) Viewed 2676 times
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: TTDViewer [2010-03-14]

Post by Emperor Jake »

Voyager One wrote:EDIT: This is weird. I've tried opening two files that have the Windows palette and TTDViewer opens easily one of them (locomotive) while says "no indexed image" for the other one (wagon). What's the difference? They're both quite the same...

The thing is that TTDViewer doesn't want to open any of my wagon's files while it opens locomotive's files normally... weird...

I've attached these two examples below, can someone take a look and possibly discover what's the problem please.
It is weird indeed. I opened them both in GIMP, neither were indexed, both show up as RGB.
juzza1
Engineer
Engineer
Posts: 95
Joined: 22 Oct 2004 19:27

Re: TTDViewer [2010-03-14]

Post by juzza1 »

Voyager One wrote:The thing is that TTDViewer doesn't want to open any of my wagon's files while it opens locomotive's files normally... weird...
That's because the wagon image is in RGB color space, while the locomotive is indexed. It does not matter whether you use one, two, 256, or 16777216 colors in the image - if the color space is not set to indexed - something that cannot be done in MS Paint* - then it will not work with TTDViewer, nor will it work as an 8-bit sprite in OpenTTD.

Some colors in the wagon image are not in the OpenTTD palette - for example, the description texts. Gimp shows 285 unique colors for this image. This is likely to silently convert the image to RGB in Paint.
Emperor Jake wrote:It is weird indeed. I opened them both in GIMP, neither were indexed, both show up as RGB.
Image -> Image Properties shows "Color space: Indexed color (256 colors)" for the locomotive. The wagon shows up as RGB.


*Apparently it sometimes keeps the color space of the source image - my guess is that any accidental addition of color outside the indexed colors silently converts the image to RGB
Last edited by juzza1 on 18 Mar 2015 12:42, edited 1 time in total.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: TTDViewer [2010-03-14]

Post by Alberth »

Voyager One wrote:I've attached these two examples below, can someone take a look and possibly discover what's the problem please.

Code: Select all

$ file IC.PNG RZD\ VL41.PNG 
IC.PNG:       PNG image data, 714 x 257, 8-bit/color RGBA, non-interlaced
RZD VL41.PNG: PNG image data, 301 x 199, 8-bit colormap, non-interlaced
ie same problem as the previous one.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
Voyager One
Tycoon
Tycoon
Posts: 11204
Joined: 28 Dec 2009 09:47
Location: Rijeka, Croatia

Re: TTDViewer [2010-03-14]

Post by Voyager One »

juzza1 wrote:That's because the wagon image is in RGB color space, while the locomotive is indexed.
Alberth wrote:same problem as the previous one.
OK, then I hgave one more question about this... as you've puzzled me even more.

BOTH these files were created in MsPaint, BOTH have been created from the SAME "base" file I ALWAYS use, BOTH were saved as simple .png files... NEITHER files were reopened or resaved in ANY other program...

Now what the hell could have caused this "non-indexing" problem?!? What's the freakin' difference? :? :x :x :x
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: TTDViewer [2010-03-14]

Post by Alberth »

Voyager One wrote:Now what the hell could have caused this "non-indexing" problem?!? What's the freakin' difference? :? :x :x :x
Technically, the difference is about 24 bit for each pixel.
8bpp images have a 256 colour palette RGB colours (no transparency), and then 8 bit for each pixel to indicate which colour from the palette to use.
RGBA images use 32 bit to specify each pixel fully in RGB + transparency.

As for how MsPaint makes a mess of things, don't ask me, I really wouldn't know. I don't have a Windows computer.


However, I can give you a good strategy to solve your problem.

Pick a program to do a task. As long as you are happy with the program, keep using it. As soon as you start to feel less happy about it, it's time to look around for alternative solutions. Try other programs to see if you like them better. As soon as you found one, ditch the old one, and pick the new one. Repeat. (that is, along as you are happy with ....)
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
Voyager One
Tycoon
Tycoon
Posts: 11204
Joined: 28 Dec 2009 09:47
Location: Rijeka, Croatia

Re: TTDViewer [2010-03-14]

Post by Voyager One »

Well then, I see one solution. I keep using the MsPaint, it seems to work correctly on my latter work, only some old files have this problem.

Sorry if I'm frustrated but I can't figure out how is it possible that and identical working process produces two so different results with no apparent reason.
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield
juzza1
Engineer
Engineer
Posts: 95
Joined: 22 Oct 2004 19:27

Re: TTDViewer [2010-03-14]

Post by juzza1 »

Voyager One wrote:Now what the hell could have caused this "non-indexing" problem?!? What's the freakin' difference? :? :x :x :x
Maybe you missed it from my earlier post, but firstly, the wagon png has 285 unique colors, while the OpenTTD palette only allows 256 at the very most. Secondly, some of the colors, namely the ones you have used in the description texts (check closely, they are anti-aliased and contain many colors) are not part of the OpenTTD palette. This will lead to MS Paint saving the image as RGB png.

EDIT: On my computer, MS Paint saved locomotive image (originally indexed) as RGB even without any editing.
User avatar
Voyager One
Tycoon
Tycoon
Posts: 11204
Joined: 28 Dec 2009 09:47
Location: Rijeka, Croatia

Re: TTDViewer [2010-03-14]

Post by Voyager One »

A-ha, I did miss this part of your post. So the reason must be me using some non-palette colors... Facepalm... :roll: :mrgreen:

... and what's worst, it seems that I've done it only on these wagons... idiot...
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: TTDViewer [2010-03-14]

Post by Transportman »

Transportman wrote:Bit of a bump, I know, but I have a problem. I have a graphics file that cannot be opened in TTDViewer because of a "No indexed image" error, but if that same file is used in the compilation of a NewGRF, compilation just runs fine and includes the image. Is there a problem with the image, or is the problem in TTDViewer itself?
Emperor Jake pointed me to what happened here, the compiler grabbed the images form the cache, instead of using the new images. Forcing the compiler to use the new images, results in a nice error that the image does not have a palette.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 9 guests