Implementing a coder for the TIM2 format

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Qjammer
Posts: 3
Joined: 2019-05-13T23:30:33-07:00
Authentication code: 1152

Implementing a coder for the TIM2 format

Post by Qjammer » 2019-05-14T03:05:29-07:00

Hello everyone,

Firstly, I'd like to thank all the devs for their immense work making an awesome image processing package.

I've recently been into disassembling PS2 videogames. This has gone mostly alright, but PS2 games use the TIM2 format for storing images and textures. After searching the internet for decoders, the only ones I found were a proprietary program and an undocumented abandoned github repo. I also found that ImageMagick has a coder for the TIM format, which is the one used by PSX games. So I decided to contribute to the FOSS ecosystem by implementing a coder for TIM2 in ImageMagick.

I've only implemented the read function, and so far I've achieved great results opening most images. It even does better than the proprietary version in some cases. For example, it can handle alpha channels and different versions of the format, which the proprietary version can't.

There are some features that haven't been implemented, mostly because I haven't found any images that use these features, mainly mipmaps and multiple-scene files.

What I'm most uncertain about is the legality of all this. I suppose that if TIM is implemented, then TIM2 would have no issue, but I'd like to be sure of this.

You can find the implementation at:
https://github.com/Qjammer/ImageMagick/tree/TIM2


I am open to suggestions, recommendations, critique, etc if you have any. I'll probably open a pull request pretty soon if there are no major issues with the code.

Please, feel free to comment with your opinion, and thanks for reading!

snibgo
Posts: 11587
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Implementing a coder for the TIM2 format

Post by snibgo » 2019-05-14T03:16:10-07:00

Qjammer wrote:What I'm most uncertain about is the legality of all this. I suppose that if TIM is implemented, then TIM2 would have no issue, but I'd like to be sure of this.
I'm no expert at licensing and copyright.

If you are using this just for yourself, I don't suppose there is a legal issue. But if your code is to be incorporated into IM, there are some questions.

Have you used code from elsewhere, or is it all your own work? If it's all yours, I don't see any problem with you contributing your code to IM.
snibgo's IM pages: im.snibgo.com

Qjammer
Posts: 3
Joined: 2019-05-13T23:30:33-07:00
Authentication code: 1152

Re: Implementing a coder for the TIM2 format

Post by Qjammer » 2019-05-14T03:30:57-07:00

snibgo wrote:
2019-05-14T03:16:10-07:00
Qjammer wrote:What I'm most uncertain about is the legality of all this. I suppose that if TIM is implemented, then TIM2 would have no issue, but I'd like to be sure of this.
I'm no expert at licensing and copyright.

If you are using this just for yourself, I don't suppose there is a legal issue. But if your code is to be incorporated into IM, there are some questions.

Have you used code from elsewhere, or is it all your own work? If it's all yours, I don't see any problem with you contributing your code to IM.
I mostly figured it out based on the little information there is on the web about this format, mostly concerning the file header layout. I've also studied the other github repo (marco-calautti/Rainbow) to figure out some stuff, but it's written in C# so there's no shared code. I did use the tim.(c|h) coder files as a rough template, but right now they're basically unrecognizable from each other.

Qjammer
Posts: 3
Joined: 2019-05-13T23:30:33-07:00
Authentication code: 1152

Re: Implementing a coder for the TIM2 format

Post by Qjammer » 2019-05-21T01:25:01-07:00

So I finally sent the pull request and it appears I am being ghosted. I suppose it might be because the CI tests are not passing.

This is beyond my control, as the tests are failing because for some reason the repository has autogenerated files commited in its history and it's not executing $automake during the build tests.

Should I add a commit including the autogenerated files, chiefly Automake.in? Or should I add a commit modifying the build script? As a general rule of thumb, committing autogenerated files is a very bad idea, since they might depend on other branches or features, but since this project seems to have them in its history, I guess it would be considered "existing coding patterns and practices"?

User avatar
magick
Site Admin
Posts: 10962
Joined: 2003-05-31T11:32:55-07:00

Re: Implementing a coder for the TIM2 format

Post by magick » 2019-05-21T04:55:39-07:00

We'll get to the TIM2 pull request. As you might imagine, ImageMagick is a huge project and there are hundreds of workstreams pending. We also need to check to ensure there are no license/patent issues associated with TIM2.

Post Reply