BG Portraits Creator
Vagdish
Member Posts: 20
Hey guys !
I created a small tools to make cropping and resizing of portraits for BG:EE easier.
Just open a file, select the zoom (with scrollwheel) and the cropping position (with mouse drag) and save it. The name will be formatted for BG:EE, as well as the image format. You can have different cropping positions and zoom sets for the three different sizes.
I also added a batch processing. Select an input and output folder, and the job will be done for any picture file found in the input folder (and subfolder).
It's written in Python, the GUI with Tkinter, and I use Pillow for image manipulation.
The source code is here : https://github.com/Vagdish/BGPyrtraits
You can run the source code with proper installation of Python 3.3 and Pillow 2.0.0.
I Freezed the app for those who doesn't want to install Python :
(see under)
Feel free to duplicate the zip file in other file hosters.
Unzip and launch the .exe.
Feedback are more than welcome on the thread (or on the github page).
Edit:// There was a bug preventing from opening jpeg picture. It's now solved.
Edit:// Here is the last version of the software: https://github.com/Vagdish/BGPyrtraits/releases/1.01/2573/BGPyrtraits-1.01.zip
I created a small tools to make cropping and resizing of portraits for BG:EE easier.
Just open a file, select the zoom (with scrollwheel) and the cropping position (with mouse drag) and save it. The name will be formatted for BG:EE, as well as the image format. You can have different cropping positions and zoom sets for the three different sizes.
I also added a batch processing. Select an input and output folder, and the job will be done for any picture file found in the input folder (and subfolder).
It's written in Python, the GUI with Tkinter, and I use Pillow for image manipulation.
The source code is here : https://github.com/Vagdish/BGPyrtraits
You can run the source code with proper installation of Python 3.3 and Pillow 2.0.0.
I Freezed the app for those who doesn't want to install Python :
(see under)
Feel free to duplicate the zip file in other file hosters.
Unzip and launch the .exe.
Feedback are more than welcome on the thread (or on the github page).
Edit:// There was a bug preventing from opening jpeg picture. It's now solved.
Edit:// Here is the last version of the software: https://github.com/Vagdish/BGPyrtraits/releases/1.01/2573/BGPyrtraits-1.01.zip
Post edited by Vagdish on
10
Comments
But your comment points out that it's not obvious. I'll try to improve that.
It looks great. 2 additional feature questions...
Is there anyway to use this from the command line so that it could be run from Weidu for example?
and is it possible to add a config file or option to select old BG portrait sizes (38x60 s and 110x170 m) in addition to the BGEE sizes?
One of the problems I've run into in making mods is I'd prefer not to include two sets of portraits, if weidu could use this to generate appropriate sized portraits when people install a mod, it would be great.
Thanks for the feedbacks.
Here is a new version of the software. If called without any arguments, it launches the GUI. If called from command line with 3 arguments, it doesn't launch the GUI, and do the conversion.
- First argument is either "--newstyle" or "--oldstyle" and define the size of the exported pictures (BGEE sizes and old BG 38x60 and 110x170 sizes respectively).
- Second argument is the input file (absolute or relative path)
- Third argument is the output files (absolute or relative path)
No "oldstyle" export from the GUI, don't think it's relevant for now.
No batch from command line. I don't know if you need one.
http://www.filedropper.com/showdownload.php/bgpyrtraits_2
I need feedback as I don't really know your exact needs for Waidu/mods.
Thanks
The exact weidu use I have in mind for this would be to take a folder with 400 BGEE small size portraits(54x84) and use something from the command line to shrink them to non-destructively copy and create 38x60 sized in a different folder. (this would be useful for the "faces mod" http://forum.baldursgate.com/discussion/18421/bgee-mod-weidu-faces-by-irbis-jalily/p1 ) as well as my mod.
Alternatively, a tool like this could with a folder full of 210x330 sized portraits to generate the 2 additional sizes (as it does now). That way people could make portrait mods and only include large sized portraits and weidu could launch an external command depending on the install detected to generate the 2 additional sizes.
Best way to do this is to add 2 (command-line) executables, one for each job.
'Will do that in a week.
Problem is I want to do it in Python (as I want to improve myself in Python in some area. threads, tkinter, pillow in this case). Without any Python installation, the distributed executables/libraries are heavy (6 Mo zipped). Doing it in C would have been lighter.
So is it still useful to have these executables in a ~10 Mo folder ? Should I do it in Python ? I could do it in C but I don't really want to (no offense but I'm doing this application for mysel first, then for the BG community).
Do it how you want. It would be nice if whatever you end up with is cross-platform runnable I guess because there might be people with Macs and PCs and IPads and android tablets trying to run this. Not all those platforms can run mods anyway, however, Mac and PC at least are running mods.. Sorry you know more about the details than I do! I don't know if C or Python would be better in that case?
If it doesn't bother you to include an archive like the one I distribute (the exec must be distributed with its own library), then I'll do it in Python.
I'll post here for updates...
Seems like it will be a great util when you get it working
I have the program working in command line, doing what you told me. I'll upload it in few hours.
@dlnorthc
I must admit I didn't test it with such a huge collection. It works well for ~100 pictures. Can you test with around 100 pictures ? Is it working ? It may become from a corrupted/bad formatted pictures, or from a bad memory management.
I'll try with the portraits dropbox repository...
Ok, I investigated the problem. If some files are corrupted, they are still opened, and trying to resize and save them can cause the application to crash.
In addition, png files with transparency are loaded and saved as bmp file without removing the transparency (bmp files don't handle transparency).
Everything should work fine now, can you run again a batch processing with your portraits library with the new build ?
@smeagolheart
With command line, you have access to two options:
BGPyrtraits.exe --smallee inputfolder outputfolder
BGPyrtraits.exe --genms inputfolder outputfolder
First one take ANY pictures in folder AND subfolders, and resize them to BG (old) small size 38x60, without taking care of the name (just copy the source file name)
Second command take ANY pictures in folder AND subfolders, and resize them to BGEE medium and small size. It replaces the "L" in the file name by "M" and "S" respectively to the new image size.
http://www.filedropper.com/bgpyrtraits10
App folder is 12 Mo, zip file is 5 Mo.
I hope I solved the crash reported by @dlnorthc
I'm very glad to hear that. Thank you for your feedback. Without it, the bug would still be there !
@smeagolheart
Keep me aware of anything you'll do with my piece of software
(I wouldn't have done the modifications if I didn't wanted you to use it in a mod)
I'm trying this out. I have a 210x330 and would like to generate L and S from cmd line at oldsizes (110x170 and 38x60). Not possible?
I tried this and nothing seemed to happen:
BGPyrtraits --oldstyle \Games\BGT\BGT\DVD\Art\BARB_4f.bmp c:\Users\Mark\Downloads\BGPyrtraits
also there are 3 versions? of your upload here in this thread including 2 in the first post... Which one should I use?
You should use http://www.filedropper.com/bgpyrtraits10
But --oldstyle doesn't exists anymore. Only these exist :
BGPyrtraits.exe --smallee inputfolder outputfolder (generate "old" S size from any pictures)
BGPyrtraits.exe --genms inputfolder outputfolder (generate "EE" M and L sizes from any pictures)
I see that you need to generate "old" L and S from pictures, and that cannot be done by command line yet.
I'll do it as soon as possible.
this is useful as is.
Can you add one more instead of taking this one away? One that generates small and medium BGT sizes.
also question:
--genms inputfolder outputfolder (generate "EE" M and L sizes from any pictures) <- EE S and M sizes?
I'll readd --oldstyle asap. (Just after work).
http://www.filedropper.com/bgpyrtraits11
I added --oldstyle argument, which is followed by input folder and output folder.
The software will take any pictures in folder and subfolders, and resize each one of them to the "old" BG sizes. Be careful though, It doesn't take care of any name duplicate. First 7 letters of the input names must be different. (But the batch processing via GUI take care of duplicate names).
Suffixes are "L" and "S", is it correct ?
I would suggest using BG2 M and S. L in BG2 is the TOB epilogue size (210x330)..
http://portraits.chosenofmystra.net/npc_portrait_change.html
I got it to work once I stopped trying to use a filename and used a folder instead. The resulting portraits were horribly pixelated? (same photo renamed)