Jpeg to TGA

IL-2 Modding help (not 3D modding):
Forum rules
IL-2 Modding help (not 3D and mapping help).
Post Reply
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Jpeg to TGA

Post by PA_Yren » Tue Oct 30, 2018 5:21 pm

I'm trying to make a java file to let IL2 convert jpeg files to tga file so could be used by game. My problem is Java 1.3 is very limited in this matter so I've tried all sort of things: using freeimage lib, create a small jpegtotga conversion program in c++ but cannot get IL2 java files use it.

Does anybody knows how to convert/use jpeg files inside IL2 java code?
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: Jpeg to TGA

Post by dr strangelove » Tue Oct 30, 2018 7:01 pm

Hi Yren, ive been looking into this area myself recently for a project i am working on ...

Im not sure if this will help...

Perhaps the easiest way to do what you want is to run a Shell from Java , this is not uncommon. You could run it silently, then you could use command line switches for ffmpeg to transcode jpg to tga. ? It is one way at least.

Although perhaps lazy, this seems popular among coders, it does work & opens the doors to anything using command line (Dos/ Bash) in Windows or Linux OS's
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: Jpeg to TGA

Post by dr strangelove » Tue Oct 30, 2018 8:32 pm

User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: Jpeg to TGA

Post by PA_Yren » Wed Oct 31, 2018 9:32 am

Doc, I've tried to send pic to shell but main problem is mod folder are not fixed folder so cannot get real path to pic... Will try to explain...

I got a pic in #MOD/@PICS/GUI/Menu/ called background.jpg.

For the game, path is GUI/Menu/background.jpg but for any program to read it, needs to be full path. When IL2 reads the file, it uses SFSinputstream class that does de magic to get the file from where ever is in #MOD folder... but when trying to get full path from SFSinputstream, I only get ...IL2 Sturmovik.../GUI/Menu/background.jpg but not got the fully path to the file so cannot open it from an external aplication...


Will try what you said...
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: Jpeg to TGA

Post by PA_Yren » Wed Oct 31, 2018 10:32 am

This is a little c++ proggie I did to try to handle it...

https://www.mediafire.com/file/9zck3p4v ... ga.7z/file
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: Jpeg to TGA

Post by dr strangelove » Wed Oct 31, 2018 10:50 am

Hi Yren,
Will take a look at this later mate
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: Jpeg to TGA

Post by PA_Yren » Wed Oct 31, 2018 10:54 am

it uses free freeimage.dll ---> http://freeimage.sourceforge.net/
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: Jpeg to TGA

Post by dr strangelove » Wed Oct 31, 2018 4:00 pm

PA_Yren wrote:
Wed Oct 31, 2018 9:32 am
Doc, I've tried to send pic to shell but main problem is mod folder are not fixed folder so cannot get real path to pic... Will try to explain...

I got a pic in #MOD/@PICS/GUI/Menu/ called background.jpg.

For the game, path is GUI/Menu/background.jpg but for any program to read it, needs to be full path. When IL2 reads the file, it uses SFSinputstream class that does de magic to get the file from where ever is in #MOD folder... but when trying to get full path from SFSinputstream, I only get ...IL2 Sturmovik.../GUI/Menu/background.jpg but not got the fully path to the file so cannot open it from an external aplication...


Will try what you said...
Ok let me see if I understand you properly...
You know already the path to the image , right?
I wasn't suggesting opening it with ffmpeg, only call ffmpeg to transcode the file with relavent switches. Call ffmpeg only to transcode / convert your background.jpg to background.tga then IL2 can read it.

How does this sound?
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: Jpeg to TGA

Post by PA_Yren » Wed Oct 31, 2018 4:55 pm

No... problem is... Real path is not game path...

let me explain...

#MOD
---@Folder1
-----GUI/Menu/background.jpg
---@Folder2
-----GUI/Menu/background.jpg
..
...

So, when game loads, background.jpg in Folder2 is overwritten by background.jpg in folder 1.

When SFSreader goes to #MOD folder looking for background.jpg, it takes only upper file with same name... in this case, background.jpg in @Folder1...

For me, path to this file is ...IL2 Sturmovik.../#MOD/@Folder1/GUI/Menu/background.jpg but FOR GAME is only GUI/Menu/background.jpg. Don't matter where is it, folder1 or 2...

So if I need to get background.jpg to convert, but DON'T KNOW if I'm in @folder1 or @folder2 I cannot get the file from an external program because in both cases, game sees same file, only GUI/Menu/Background.jpg. At first, I will not know if @folder1 or @folder2 exist... cause, @folder1 overwrites @folder2


It's a very little confusing but is as game works with mods...


So, SFSReader class, does some magic inside (so deeper I cannot understand) to get the right file from mod folders, but this file is adresses relative to game GUI, i18n... not by real path... So only posibility is get a stream of bytes using SFSREader and convert it...
User avatar
dr strangelove
FM Modding Expert
Posts: 3479
Joined: Sun Dec 18, 2016 10:07 am

Re: Jpeg to TGA

Post by dr strangelove » Wed Oct 31, 2018 7:20 pm

ok, thanks for trying to explain to me

i see it is difficult
So if I need to get background.jpg to convert, but DON'T KNOW if I'm in @folder1 or @folder2 I cannot get the file from an external program because in both cases, game sees same file, only GUI/Menu/Background.jpg. At first, I will not know if @folder1 or @folder2 exist... cause, @folder1 overwrites @folder2

i understnad , It is hard to write Java to run Shell with FFmpeg because IL-2 reads only one location but it is also in other locations
will help you work if you turn off RandomSplash=1 change to RandomSplash=0 ?
with this only one Background.jpg & location folder ?... just a thought / suggestion
I cannot get the file from an external program because in both cases, game sees same file, only GUI/Menu/Background.jpg
Is it possible to convert all instances of Background.jpg in all folders ?

I am sorry , i am not much help right now , i am working on other project
Post Reply

Return to “Modding Help (not 3D)”

Who is online

Users browsing this forum: No registered users and 14 guests