Shorten filename suffixes without recompiling Hugin

87 views
Skip to first unread message

Abrimaal

unread,
Sep 9, 2020, 6:46:40 PM9/9/20
to hugin and other free panoramic software
What files should I modify to shorten the _blended_fused and _fused suffixes to _bf and _fd ?
Multiple stitching of panoramas and making collages creates extremely long filenames.

Then automatic renaming that obviously doesn't rename contents of .pto files, if a file with _blended_fused suffix is added to a new .pto project file

I already tried, but there are too many blended_fused strings only in the main .exe file.
So I don't know which of them are responsible for filename suffixes, which of them may be labels, variables or commands.



Abrimaal

unread,
Sep 15, 2020, 9:36:25 AM9/15/20
to hugin and other free panoramic software
Are the suffixes generated by hugin.exe or one of the co-apps?
I could try to recomplile from source, just tell me in which file are the suffixes defined.

privacyis...@gmail.com

unread,
Oct 9, 2020, 5:45:40 PM10/9/20
to hugin and other free panoramic software
Hi. COVID sucks, I have a half hour to kill. Here's a small novel.
----

Yes. Both. Yes. Sure, skip down / skim, or just read it.

Assuming you extracted the hugin source thusly?

D:\code\hugin\hugin-2019.2.0> grep -RHEn "(_blended_fused|_fused)" *

StitchingExecutor.cpp:697:                const wxString fusedExposureLayersFilename(prefix + wxT("_blended_fused.") + opts.outputImageType);
StitchingExecutor.cpp:738:                    const wxString fusedStacksFilename(prefix + wxT("_fused.") + opts.outputImageType);

Just change the text in the quotes to "_bf" and "_fd" and compile. Doing it this way will change it so any reference by any of the multiple programs that make up hugin will use your truncated names, and nothing will break or require hand-editing to fix. (Note this is not what you should be doing, but that is what you asked for.) You'll need to install a LOT of tools, first of all even grep is not part of Windows by default. There's no unix dev environment by default. You can enable the Windows Subsystem for Linux (WSL) if you want to get that going, but you'll still need a full GNU dev environment and all the prerequisites installed and properly configured.

Don't take this the wrong way, you were trying to hexedit the precompiled binary of an open-source project to change it, so this is might be a long road for you for something simple.

I'd suggest 2 alternatives. 1) Just write a batch file to rename the files after-the-fact, or 2) customize an executor so you can make your own output filenames, that's what most of us do.

Let me outline an example:

Go into Program Files\Hugin\share\hugin\data, pick the one you have the problem with _blended_fused, which is fused_layers.executor. Copy that to something else, abri_fused_layers.executor then edit it. (use something that understands unix line endings like notepad++ / bluefish / brackets / even wordpad) Change the Description= and Help= lines, to make it something unique, now go down to the Result line and change it to read something like Result=%prefix%_bf.tif

That's it. Save and exit. Now load up an already-optimized and ready-to-stitch .pto file in hugin gui, click Output / User defined output sequences / and the Description you chose. Boom, there it goes. And there goes your intermediate files being named what you wanted. You can make as many of these as you need, every scenario every file type, there's enough examples in that directory for you to customize anything you want, and again, no recompiling required. You could make your own assistant if you chose to.

I'm not sure if there's a default one that you can change the executor of that will change the hugin GUI so that when clicking the Stitch! button with fused and blend settings, it'll use your modified version, or if you'll need to recompile for that. But this here will get you going.

Have a great day.

Abrimaal

unread,
Oct 13, 2020, 12:10:31 AM10/13/20
to hugin and other free panoramic software
First maybe without the source code if I need to install almost a new system to change one constant.

I have searched for "_blended_fused" string in the hugin_version_number\bin folder
It occurs only twice in hugin.exe, in lines 9757 and 9759. No occurences in other files. (if not encoded in UTF-16, because I have no editor to search for text in UTF-16)
output_blended_fused_bitmap and a sequence of NUL (zeros)
The same for _fused, two occurences in the same lines, but it is not just _fused but _fused_blended
output_fused_blended_bitmap and a sequence of zeros.

Now I am unsure if these strings are responsible for generating filenames
or they are parts of GUI, the displayed text in menu
or they are internal labels of the program.

blended_fused contains 13 characters. If I replace them with two character bf and add 11 zeros after _bitmap
to preserve relative offsets and the total length of the file will remain unchanged.
Is there a chance to work?
This way I modified displayed text in games and other .exe files and they work.

I used the alternative that you suggested, to rename files after the fact. Using Bulk Rename Utility
that changed thousands of _blended_fused and _fused suffiixed to _bf and _fd, but...
these files are often included in projects, such as video slideshows, batch photo post-processing
or just refining the panorama in Hugin by masking and merging both images into one.
The filenames remain in projects and the project files become useless after renaming.

I am interested how to customize the executor. In Hugin settings there is no such option. I can define only the main filename, not suffixes.

Abrimaal

unread,
Oct 13, 2020, 12:31:30 AM10/13/20
to hugin and other free panoramic software
No, certainly not this way. Simple replacing blended_fused and fused_blended to bf and fd
and adding 11 random characters does nothing, the output suffixes are still the same.
So, temporarily I give in searching for another method.

output_bf_bitmap12345678901.png
output_bf12345678901.png
Reply all
Reply to author
Forward
0 new messages