New Sprites - Help me understand PNG offsets

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

New Sprites - Help me understand PNG offsets

Postby Custodian » Fri Mar 05, 2021 3:23 pm

I am creating sprites using 3D software. The renders come out with a great deal of negative space, like so:

too much negative space
But, when I import my sprites into my Pk3 with SLADE, my large original images are positioned perfectly when I use the 'auto offset' feature. They appear exactly as I intend them to.

With that said, I would like to reduce the filesize significantly, so I have created a simple macro for a command-line image utility (ImageMagick) to trim the negative space and reduce the file size. The resulting trim of the above image looks like this:

a neat crop

Code: Select allExpand view
magick ${file.name} -fuzz 1% -trim  trimmed_${file.name}

After I import my cropped images into my Pk3, auto-aligning them results in incorrect positioning on the screen.

I have a large volume of sprites which are impossible to manually realign by hand. Some of my monster sprites have thousands of frames. It is my understanding that offset data is stored in the PNG somehowâ„¢. This is where my knowledge falters, I have only a very basic understanding of how data is stored in files, and don't really have a grasp on manipulating binary data. My ideal solution is one where I have to do as little work as possible. I would like to know if anyone has any experience with ImageMagick, and knows if there is a way to amend my command to simply inject offset data.

If this understanding is incorrect, is there some existing and tested solution I could implement or an alternate way to approach this?

Left - correct. Right - incorrect.


EDIT: Also, I will not be using these particular sprites in any projects, I've decided to scrap them in favor of a different design. I'll post the full set later.
User avatar
Custodian
 
Joined: 29 Jan 2021
Github ID: disasteroftheuniverse
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: New Sprites - Help me understand PNG offsets

Postby Ashat Maself » Mon Apr 05, 2021 1:48 pm

you can just drag around the sprites in the editor to change offsets
Ashat Maself
 
Joined: 02 Apr 2021

Re: New Sprites - Help me understand PNG offsets

Postby Matt » Mon Apr 05, 2021 2:03 pm

I have a large volume of sprites which are impossible to manually realign by hand. Some of my monster sprites have thousands of frames.
Pay someone to spend the time doing all that for you? :S
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: New Sprites - Help me understand PNG offsets

Postby phantombeta » Mon Apr 05, 2021 2:31 pm

Or use a program to do it automatically. Such a thing already exists.
User avatar
phantombeta
Tired of being treated like trash by control freaks
 
Joined: 02 May 2013


Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 0 guests