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.
User avatar
Custodian
Posts: 62
Joined: Fri Jan 29, 2021 8:24 pm
Graphics Processor: ATI/AMD (Modern GZDoom)
Location: Minneapolis MN, USA

New Sprites - Help me understand PNG offsets

Post by Custodian »

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 all

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
Ashat Maself
Posts: 61
Joined: Fri Apr 02, 2021 5:32 am

Re: New Sprites - Help me understand PNG offsets

Post by Ashat Maself »

you can just drag around the sprites in the editor to change offsets
User avatar
Matt
Posts: 9693
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: New Sprites - Help me understand PNG offsets

Post by Matt »

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
phantombeta
Posts: 2039
Joined: Thu May 02, 2013 1:27 am
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: New Sprites - Help me understand PNG offsets

Post by phantombeta »

Or use a program to do it automatically. Such a thing already exists.

Return to “Assets (and other stuff)”