Windows/Linux script for extract default pictures for all maps

External tools, software and sites for creating or editing UT99 resources.
dot
Average
Posts: 59
Joined: Tue Oct 30, 2018 3:41 am

Windows/Linux script for extract default pictures for all maps

Post by dot » Tue May 19, 2020 4:18 pm

It is not by me. I only mirrored here from: http://www.unrealadmin.org/forums/showt ... hp?t=29928

Pack of many pictures for some maps (323 maps):
img.rar
lower case named version:
imglower.rar
Script for extracting pictures from your's maps:
extractimg.rar
version to lower case named files:
extractimglower.rar
U need place this file on the root folder of your's ut server and run it. This works only for windows 2000 and high. Linux not supported. But this is very simple and u may be create some scripts for others OS.
After running script opens folders, placed in root your's ut server and named "img". This folders contains many bmp files for maps, if u need - convert to other grafics format any graphics converts such as ACDSEE.
For extracting picture used ut engine, and if on maps don't present some packages, then picture don't been extracted.

Sample using:

Code: Select all

G:\UT   <------ Please place this file extractimg.bat from archive and run it
├───Cache
├───Eal
├───Help
├───Logs
├───Manual
├───Maps
├───Music
├───NetGamesUSA
├───Sounds
├───System
│   ├───editorres
│   └───moviedemomanager-v1.0
├───Textures
└───Web
    ├───images
    └───plaintext
Wait until window with script displayed (this is some minutes)
On the end, script try to open folder with pictures:

Code: Select all

G:\UT
├───Cache
├───Eal
├───Help
├───img           <------- Pictures placed here
├───Logs
├───Manual
├───Maps
├───Music
├───NetGamesUSA
├───Sounds
├───System
│   ├───editorres
│   └───moviedemomanager-v1.0
├───Textures
└───Web
    ├───images
    └───plaintext
Note: if exist folder temp_img on the root ut server, then will be deleted. this is folder for temporary storage for extracting from map.

Text data:
extractimg.bat:

Code: Select all

@echo off
if not exist temp_img mkdir temp_img
if not exist img mkdir img
for %%F in (maps/*.unr) do (
title Procees %%~nF...
system\ucc batchexport %%F Texture bmp ..\temp_img\
if exist temp_img\screenshot.bmp copy temp_img\screenshot.bmp img\%%~nF.bmp >nul
del /f/q temp_img\*.bmp >nul
)
rmdir temp_img
start img\
extractimglower.bat (need program renlower.exe):

Code: Select all

@echo off
if not exist temp_img mkdir temp_img
if not exist img mkdir img
for %%F in (maps/*.unr) do (
title Procees %%~nF...
system\ucc batchexport %%F Texture bmp ..\temp_img\
if exist temp_img\screenshot.bmp copy temp_img\screenshot.bmp img\%%~nF.bmp >nul
renlower img\%%~nF.bmp
del /f/q temp_img\*.bmp >nul
)
rmdir temp_img
start img\
renlower.exe - CLI program, takes one argument - filename, and rename it to lowercase. In PHP its maybe:

Code: Select all

<?php rename($argv[1], dirname($argv[1]).'/'.strtolower(basename($argv[1])));
Look like this info partially published before: viewtopic.php?f=5&t=12494
You do not have the required permissions to view the files attached to this post.
Last edited by dot on Wed May 20, 2020 3:31 am, edited 1 time in total.

User avatar
Barbie
Godlike
Posts: 2393
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Windows script for extract default pictures for all maps

Post by Barbie » Wed May 20, 2020 1:22 am

What is the sense to lower all letters to lower case? If you write the file names by hand, it might be useful because you don't have to remember the case, but I assume that the BMP files are processed by a script.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

dot
Average
Posts: 59
Joined: Tue Oct 30, 2018 3:41 am

Re: Windows script for extract default pictures for all maps

Post by dot » Wed May 20, 2020 3:31 am

IDK. In original thread exists such request.

Here my conversion for linux. Supported normal UT and with LOKI path.

Code: Select all

#!/bin/bash
mkdir -p img
cd System
if [ -d ~/.loki ]; then 
	temp_img=~/.loki/ut/System/temp_img;
else
	temp_img=temp_img;
fi
mkdir -p $temp_img

for unr in ../Maps/*.unr; do
	ucc-bin batchexport $unr Texture bmp temp_img/;
	cp $temp_img/Screenshot.bmp ../img/$(basename $unr .unr).bmp;
	rm -f $temp_img/*.bmp;
done

rmdir $temp_img
cd ..
Add some images from my sources. Total 771 images for many maps.
Many of them is MH.
img2.rar
You do not have the required permissions to view the files attached to this post.