Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Dec 12, 2017 4:27 am

All times are UTC




Post new topic  Reply to topic  [ 31 posts ]  Go to page 1 2 Next
Author Message
 Post subject: TTDViewer [2010-03-14]
PostPosted: Sun Jan 24, 2010 4:54 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 973
Location: Aschaffenburg
Hello,
during december I wrote this little tool. (The fools from IRC might already have seen parts of it.)

So what does it do?
You can open a .png or .pcx image which uses the TTD palette.
TTDViewer detects the palette of the image (DOS/Win), converts it to the DOS palette if needed, and then displays the image.
So far so boring. More interesting:
  • It does the TTD palette animation. You can start/stop animation or enable/disable particular animation cycles.
  • You can apply any of the default TTD recoloursprites, that is you can interactively apply company colours,
    random industry colours, or just display the whole image as in the newspaper.

The screenshot shows TTDViewer displaying the toy factory from OpenGFX, zoomed 3x and recoloured to yellow.
Attachment:
File comment: screenshot
TTDViewer.png
TTDViewer.png [ 49.79 KiB | Viewed 5990 times ]


While TTDViewer is currently only a little gimmick and has somewhat limited usage, it is written in Java which should allow
new tools to start from it. So: Get it, start it, enjoy it, enhance it!
(Hints: Maybe someone wants to convert it into an applet, which can be display the sprites published on this forum and thus allows to zoom, animate and recolour all graphic previes here. Or well, maybe someone is bored enough, to enhance it to a full-features multi-layered paint program, but err - ok, I will stop here :p )

TTDViewer is versioned using Mercurial. The guys from #OpenTTDCoop were so nice to host the repository for it, they even provide a build-service :)

License: GPL v2
Project site: http://dev.openttdcoop.org/projects/ttdviewer
Repository: http://hg.openttdcoop.org/ttdviewer

Download (nightly build): http://bundles.openttdcoop.org/ttdviewe ... es/LATEST/

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Last edited by frosch on Wed Aug 01, 2012 5:12 pm, edited 4 times in total.

Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Sun Jan 24, 2010 10:45 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 31, 2007 2:23 pm
Posts: 4433
Location: Standing by the jams
Looks like it would be useful :)

Although it's Java, I can't get it to start on OS X (10.5). Hey ho. Here's a paste of console in case it's useful. If it's just an Apple->Java thing don't worry about it.

Code:
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045] SystemFlippers: didn't consume all data for long ID 0 (pBase = 0x100131b40, p = 0x100131b44, pEnd = 0x100131b48) 
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045] SystemFlippers: didn't consume all data for long ID 0 (pBase = 0x10012ca40, p = 0x10012ca44, pEnd = 0x10012ca48)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045] SystemFlippers: didn't consume all data for long ID 0 (pBase = 0x10012ca40, p = 0x10012ca44, pEnd = 0x10012ca48)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045] Exception in thread "main" 
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045] java.lang.UnsupportedClassVersionError: Bad version number in .class file
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.lang.ClassLoader.defineClass1(Native Method)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.security.AccessController.doPrivileged(Native Method)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
24/01/2010 22:43:45 [0x0-0xb6eb6e].com.apple.JarLauncher[86045]  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)

_________________
FIRS Industry Replacement Set (Released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (Finished)
Squid Ate FISH (ships) (Released) | CHIPS Has Improved Players' Stations (Finished)
Iron Horse (trains, released) | Termite (tracks for Iron Horse, released) | Busy Bee (game script, released)


Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Sun Jan 24, 2010 10:53 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
andythenorth wrote:
Looks like it would be useful :)

Although it's Java, I can't get it to start on OS X (10.5). Hey ho. Here's a paste of console in case it's useful. If it's just an Apple->Java thing don't worry about it.

From that log it looks like your java version is too old. I just checked java.sun.com and they don't provide mac binaries, they state apple does that from time to time.


Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Sun Jan 24, 2010 11:46 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed May 16, 2007 4:59 pm
Posts: 2789
Excellent! Simple yet effective. I've done some quick testing and it works well but with a couple of bugs:
* When trying to open an "incorrect" file, ie. a non-paletted png, it gives no error or anything. A simple "incorrect palette" error would be nice.
* I tend to get redrawing problems in the image preview bit of the window, eg. when the file browser window gets closed you get bits of it "getting stuck" on the preview image.
* When stopping the palette animation it doesn't revert back to the palette colour, it just stops the animation. I think it would be neater behaviour to reset to the palette-encoded colour.

Great work though, a very useful tool.

_________________
GRVTS/eGRVTS --- Generic Tram Set --- UK Town Set --- zBase ---RichardWheeler.net


Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Mon Jan 25, 2010 12:58 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6559
Location: The Netherlands
Looks like a very nice tool indeed. Too bad it's in Java though, as that is something I cannot use on my computer...

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Mon Jan 25, 2010 7:23 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 973
Location: Aschaffenburg
lol, so I picked Java to juggle all those nasty platforms, and then 20% users report it does not work due to Java :p

Anyway, andy, you might try checking out the source and run "make run". The jar however is created using some "newer" feature to create a Manifest on the fly.

@Zephyris: Thanks for testing. And yes, the GUI is somewhat minimal :)
I guess the non-palettized .png might even print something to the console :p
About the palette animation: The TODO list contains some play/pause, stop buttons, maybe also some speed control. However, currently you can get the effect by unchecking all the animation checkboxes.

About the drawing: Confirmed, I do not draw any background. Did not notice yet :s

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Tue Jan 26, 2010 5:30 pm 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
frosch wrote:
lol, so I picked Java to juggle all those nasty platforms, and then 20% users report it does not work due to Java :p

Write Once, Debug Everywhere.

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Tue Mar 09, 2010 3:13 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed May 16, 2007 4:59 pm
Posts: 2789
I am getting a "Palette not detected." error whenever I try to open the attached file. According to two programs (GIMP and ImageJ) it is an 8bit (paletted) .png and the palette seems to load correctly, what could be going wrong?


Attachments:
1467-1468.png
1467-1468.png [ 7.56 KiB | Viewed 5437 times ]

_________________
GRVTS/eGRVTS --- Generic Tram Set --- UK Town Set --- zBase ---RichardWheeler.net
Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Tue Mar 09, 2010 7:54 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 973
Location: Aschaffenburg
Well, TTDViewer tries to detect DOS or WIN palette. But the palette of the image is far from those.

That would need some "import true colour" image function, which would pick the nearest colours while ignoring any animation colours. But that is currently out of the scope of the tool :)


Attachments:
1467-1468_palette.png
1467-1468_palette.png [ 10.01 KiB | Viewed 5392 times ]

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Tue Mar 09, 2010 8:03 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed May 16, 2007 4:59 pm
Posts: 2789
Ah, I had missed the "remove unused colours from colourmap" option on the gimp convert to indexed dialog; all works as expected now.


Attachments:
donotdiscardcolours.PNG
donotdiscardcolours.PNG [ 23.93 KiB | Viewed 5387 times ]

_________________
GRVTS/eGRVTS --- Generic Tram Set --- UK Town Set --- zBase ---RichardWheeler.net
Top
   
 Post subject: Re: New Tool: TTDViewer
PostPosted: Sun Mar 14, 2010 5:32 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 973
Location: Aschaffenburg
New version in first post :)

Most noticable features are auto-reloading of files after modification on disk, and mouse panning + wheel zooming.

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
PostPosted: Fri Dec 31, 2010 6:55 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Apr 24, 2007 9:37 am
Posts: 2897
Location: Straya
Hi,

This would be a very useful tool, but no matter what I try, it says "Palette not detected"
What exactly do I need to do to make it work? (I have GIMP)

Thanks,
Jake

EDIT: Never mind, I figured it out. I was using the wrong palette file.

Thanks for the useful tool!

_________________
--Stuff I made (or helped make)--
ImageImageImageImage

--My Award-Winning Screenshots and Videos--


Top
   
PostPosted: Sun Mar 15, 2015 5:50 pm 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2597
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?

I attached one of the images that I have problems with ( contained in the archive in this post ).


Attachments:
File comment: Image with problems
Gen4_Hopper_Type1_Gray.png
Gen4_Hopper_Type1_Gray.png [ 31.99 KiB | Viewed 2099 times ]

_________________
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Top
   
PostPosted: Sun Mar 15, 2015 6:04 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4513
Location: home
My magic 'file' comand says:
file wrote:
Gen4_Hopper_Type1_Gray.png: PNG image data, 714 x 257, 8-bit/color RGBA, non-interlaced
In other words, a 32bpp image.
TTD viewer seems to expect a 8bpp image ("indexed image" being the clue here, as that's another name for 8bpp images).

_________________
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.


Top
   
PostPosted: Sun Mar 15, 2015 6:31 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Dec 28, 2009 9:47 am
Posts: 11015
Location: Rijeka, Croatia
My file so... what did I do wrong here?

_________________
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield


Top
   
PostPosted: Sun Mar 15, 2015 6:36 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4513
Location: home
Either you used the wrong file format, or TTDviewer is obsolete in not understanding 32bpp images.
Given that the program was written before adding 32bpp images, the latter is not a surprise.
Let's wait what its author has to say about it (maybe there is a project somewhere, where you can look at open issues?)

_________________
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.


Top
   
PostPosted: Mon Mar 16, 2015 10:27 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Dec 28, 2009 9:47 am
Posts: 11015
Location: Rijeka, Croatia
Alberth wrote:
wrong file format

Simple .png, never anything else. All drawings made in the lowly MsPaint, no other editing or corrections... :?

Alberth wrote:
32bpp images

But these are supposed to be 8bpp sprites, I don't understand did they get converted to "32bpp"... :?

_________________
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield


Top
   
PostPosted: Mon Mar 16, 2015 11:37 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4513
Location: home
Voyager One wrote:
Alberth wrote:
wrong file format

Simple .png, never anything else. All drawings made in the lowly MsPaint, no other editing or corrections... :?
.png supports a whole range of formats, from black/white 1bpp black/white images downto 32bpp RGBA. I haven't read the PNG standard, but probably the file format supports even more exotic images.
As such ".png" is ambiguous as indication of what you have.

Voyager One wrote:
Alberth wrote:
32bpp images

But these are supposed to be 8bpp sprites, I don't understand did they get converted to "32bpp"... :?
Easy, you saved the picture as full-colour image, or whatever nice name MS gave to it.

Many people think that 8bpp == old-school hand-drawn pixels, and 32bpp == full-colour blendered pixels, and in many cases that's actually true.
However what most do not realize is that these are upper limits only. You cannot have 257 different colours or 53% transparency in 8bpp, because that format cannot store that information.
For this reason, you never find full-colour blendered pixels in 8bpp. The format just isn't capable of storing the information associated with each pixel.
It's like trying to put a very big box into a small van. It won't work, you need a big van instead.

However, the reverse is not true. I can take a big van and put a very small package in it. It's overkill, but it works. In the same way, you can use a full-colour 32bpp file format, and store a pure black/white image in it (ie a 1bpp image). In your case, you can store the information of 256 colour pixels in a 32bpp format.
Obviously, in your case, using an 8bpp format would reduce storage requirements, just like using a small van for small boxes reduces costs.

_________________
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.


Top
   
PostPosted: Mon Mar 16, 2015 6:52 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Dec 28, 2009 9:47 am
Posts: 11015
Location: Rijeka, Croatia
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? :?

_________________
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield


Top
   
PostPosted: Mon Mar 16, 2015 8:10 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 973
Location: Aschaffenburg
TTDViewer is meant to display palette animated and recoloured 8bpp sprites
32bpp sprite do not have such things, you can just look at them using your drawing program.

Why would anyone want to use TTDViewer for 32bpp images? ?(

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 31 posts ]  Go to page 1 2 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.