Page 1 of 1

New Sprites - Help me understand PNG offsets

PostPosted: Fri Mar 05, 2021 3:23 pm
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 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.

Re: New Sprites - Help me understand PNG offsets

PostPosted: Mon Apr 05, 2021 1:48 pm
by Ashat Maself
you can just drag around the sprites in the editor to change offsets

Re: New Sprites - Help me understand PNG offsets

PostPosted: Mon Apr 05, 2021 2:03 pm
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

Re: New Sprites - Help me understand PNG offsets

PostPosted: Mon Apr 05, 2021 2:31 pm
by phantombeta
Or use a program to do it automatically. Such a thing already exists.