File Name: BAM Resizer
File Submitter: Sam.
File Submitted: 20 Aug 2014
This nifty little tool was developed to try and facilitate the porting of PST avatars to BG2. The problem was that all the Planescape avatars were larger than those in Baldur's Gate 2 by a 4:3 ratio. The author's name is unknown, but we appreciate his efforts.
bamresize v2.9 Code contributions by Avenger_teambg and Sam. bamresize [OPTIONS] filename.bam [filename2.bam...] Resizes all frames in filename.bam, creating a new file called filenamer.bam. The filename(s) to convert can use wildcards. Options: '-p PERCENT' '--percentw PERCENT' Frame widths are resized by PERCENT percent. Default is 75 '-q PERCENT' '--percenth PERCENT' Frame heights are resized by PERCENT percent. Default is the value for -p (if specified), otherwise it is 75 '-x NUMBER' '--modxoffset NUMBER' Modify (either increment or decrement) x offsets by NUMBER. Default is 0 '-y NUMBER' '--modyoffset NUMBER' Modify (either increment or decrement) y offsets by NUMBER. Default is 0 '-s NUMBER' '--setxoffset NUMBER' Set x offsets to NUMBER. Default is NONE '-v NUMBER' '--setyoffset NUMBER' Set y offsets to NUMBER. Default is NONE '-u VALUE' '--unify VALUE' Pad frames before resize to make dimensions and offsets uniform. This eliminates frame 'twitching' when resized. For VALUE, 0 is OFF, 1 is ON, and 2 is square. Default is 1. '-t VALUE' '--trim VALUE' Trim transparent padding from frame after resize. (Opposite of --unify) For VALUE, 0 is OFF and 1 is ON. Default is 1. '-e FORMAT' '--export FORMAT' Export frames in the basic format indicated by FORMAT. Examples include "bmp", "png", and "gif". Default is do not export. '-h' '--help' Print this message. Examples: bamresize MNO3A1.bam Resizes all the frames in MNO3A1.bam by 75% and creates MNO3A1r.bam bamresize -p 50 -q 150 c:\extractedBams\*.bam Resizes all frame widths by 50% and all frame heights by 150% for all .bam files in the \extractedBams dir. bamresize -p 100 -s -10 -y 15 ABATG1.bam Sets all x offsets to -10 and increments all y offsets by 15 without resizing frames.
See <src\usage.txt> for extended usage and examples.
Version History: v1.5 (17 February 2003) * Latest release on PPG v2.1 (13 October 2013) * Implemented Avenger_teambg's end main() and resizeFrame() fixes from <http://forums.pocketplane.net/index.php/topic,28376.0.html> * Fixed a bug in compressFrame() that caused pixel row misalignment in BAM frames after resize under some circumstances. v2.2 (11 January 2014) * Width and height resizing is decoupled to allow specifying separate values. Use "-p" to scale width and "-q" to scale height. Whichever ones not specified will default to 75%. v2.3 (19 January 2014) * Value of -q (height) now defaults to the -p (width) value (instead of 75%) if it is otherwise unspecified. v2.4 (18 March 2015) * Fixed a bug in the frame offset calculations of negative numbers. * Added option to not recalculate (scale) frame offsets with resize. ['-n' or '--norecalcoffset'] * Added option to modify (either increment or decrement) x and y offsets by a positive or negative number. ['-x NUMBER' or '--modxoffset NUMBER'] and ['-y NUMBER' or '--modyoffset NUMBER'] * Added option to set x and y offsets to a positive or negative number. ['-s NUMBER' or '--setxoffset NUMBER'] and ['-t NUMBER' or '--setyoffset NUMBER'] * Compiled into self-contained EXE. v2.5 (16 June 2015) * Added option to pad the frames (with transparent pixels) before resizing them to ensure the resized dimensions and offsets are uniform. This eliminates frame 'twitching' when resized. ['-u' or '--unify'] * Added option to trim the padding (transparent pixels) from the frames after resizing them. This is the opposite of --unify. ['-t' or '--trim'] * Removed option to not recalculate (scale) frame offsets with resize. ['-n' or '--norecalcoffset'] * Modified the option to set the y offset to a positive or negative number to use ['-v NUMBER' or '--setyoffset NUMBER'] instead of ['-t NUMBER' or '--setyoffset NUMBER'] v2.6 (20 June 2015) * Improved handling of very small frame dimensions (<= 1 px). * Added undocumented ['-d' or '--debug'] option to print some debug information to console. v2.7 (22 June 2015) * Updated Python to v2.1.3, updated PyWin32 to Build 151, and upgraded the Python Imaging Library to v1.1.5. * Included installers for the above plus PyInstaller for posterity. * Included the entire PIL with BAM Resizer. * Added option to export the frames as BMPs. ['-e' or '--export'] * Fixed several bugs in how input Options were processed. * Unify and Trim options are now ON by default and require a second parameter when specified: ['-u VALUE' or '--unify VALUE'] and ['-t VALUE' or '--trim VALUE'] * Unify can now pad the frames until they are square by setting the option's value to 2. ['-u 2' or '--unify 2'] v2.8 (06 July 2015) * Fixed a bug in how unify was implemented when set to square. * Fixed a bug where frames were being exported before being resized, not after. * Fixed several more bugs in how input Options were processed, resulting in them being applied in a more logical order. * Added option to export frames in the basic format indicated by FORMAT: ['-e FORMAT' or '--export FORMAT'] Examples include "bmp", "png", and "gif". Default is do not export. * usage.txt documentation included. v2.9 (06 December 2016) * Improved handling of corrupt RLE'd frame data.
Edited by Sam., 07 December 2016 - 06:31 PM.