Sprite Center Cropper - Crop sprites and keep them centered!

Any utility that assists in the creation of mods, assets, etc, go here. For example: Ultimate Doom Builder, Slade, WadSmoosh, Oblige, etc.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
Posts: 1300
Joined: Tue Dec 06, 2016 11:25 am

Sprite Center Cropper - Crop sprites and keep them centered!

Post by Cherno »

Sprite Center Cropper is a tool that removes empty space from bitmaps while keeping the non-empty part horizontally centered. The main reason it was written was to minimize the file sizes of sprites made from a rendered model to use in GZDoom. A sprite rendered in a 3D modeling application typically has a large amount of empty space around it which bloats the file size. Various methods exist that simply crop the sprite so empty space around it is removed, but in the context of sprite renders this has one disadvantage: The sprite's original center is lost. This tool allows to keep this original horizontal center so a large number of sprites can easily have their offsets set via SLADE or other programs without having to set each sprite's offsets one by one.

Using the tool:
Set the input folder to the directory the sprites are in.
Set the output folder to the directory the cropped sprites should be saved in.
If you have additional bitmaps (brightmaps, in particular), do the same for these. The additional bitmap files ned to have the same names as the primary ones. The additional bitmaps will be cropped in the exact same way as their primary counterparts, no matter if they have any empty spaces or not.

"Top" checkbox - Crop any empty space from the top. You will probably want to keep this checked in most cases.
"Bottom" checkbox - Crop any empty space from the bottom. I gnerally do not crop from the bottom for sprites that have been rendered with a camera using orthographic projection, but do so for non-orthographic projection cameras.

Click the "Crop!" button to start the process. A green bar will appear showing progress.

IMPORTANT! Note that the application might appear to hang or not respond for quite some time depending on the number and size of the bitmaps being processed. Just wait until the green bar is full, which might take several minutes, during which the bar might not fill at all until the end.

Example process: Note How the file size is minimized by cropping empty space while keeping the horiozontal center intact, allowing for easy offset setting in SLADE.
The black border and green center line were added for presentation purposes.

Original image:

Cropped image:
You do not have the required permissions to view the files attached to this post.

Return to “Creation, Conversion, and Editing”