Batch tool to list grAb values to console output

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
MartinHowe
Posts: 2040
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom

Batch tool to list grAb values to console output

Post by MartinHowe »

I need to edit several dozen images that will not change their dimensions or the internal alignment. However, most image editing tools discard PNG chunks they don't know about, so the grAb values will need to be reimposed.

It's tedious and time consuming to do this in GUI tools, but while grabpng can be used to set the chunk, it can't output then to a terminal or textfile.

Does anyone know of a command line tool to do this? E.g., pnginfo bossa2a8.png >> sprites.grAb.txt ? DeuTex is supposedly able to do this, but it's not in the -help report :?
User avatar
Caligari87
Admin
Posts: 6189
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him

Re: Batch tool to list grAb values to console output

Post by Caligari87 »

ImageMagick tools (convert, mogrify, identify, etc) will probably do what you want. Documentation seems a bit sparse on this point but it seems clearly able to read and write PNG chunks.

https://stackoverflow.com/questions/903 ... -png-image

I've also seen some mention of a tool called pngcheck.

https://unix.stackexchange.com/question ... s-metadata

8-)
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space

Re: Batch tool to list grAb values to console output

Post by NeuralStunner »

ImageMagick is what Slade uses, so that should more or less work fine.

One thing to keep in mind: If you modify 256-color PNGs with transparency, it might resave them with the transparent index changed. This is what usually happens to me in Slade, at least.
User avatar
MartinHowe
Posts: 2040
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom

Re: Batch tool to list grAb values to console output

Post by MartinHowe »

Thanks; I did look at some of these, but for setting, I can use GrabPNG in console mode, it works fine in WINE; however, reading the offsets and outputting them as text in batch mode is what's needed here.

These tools don't report on grAb; I've looked at many tools, including those above, but hardly anyone mentions the grAb chunk in their command line software. Is this a chunk special to ZDoom or is it part of an official definition somewhere?
User avatar
Caligari87
Admin
Posts: 6189
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him

Re: Batch tool to list grAb values to console output

Post by Caligari87 »

So far as I'm aware, PNG can have arbitrary chunks of data attached to it, so grAB may not be in an official spec or directly recognized. It seems many tools may ignore or strip chunks they don't recognize, so look for an option to override that behavior.

If you are on Linux or can run Linux software (such as via WSL) it looks like there's also a utility called pngchunks which may be able to help. Seems there may be a Windows-compat version as well in PngUtils.

8-)
User avatar
phantombeta
Posts: 2104
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Batch tool to list grAb values to console output

Post by phantombeta »

grAb is indeed special to ZDoom, so you won't find it outside of tools made for ZDoom modding. Unfortunately, a lot of programs always discard unknown chunks, even if it's stated to be safe to copy regardless. (which grAb is, since the 4th letter of the name is lowercase)
I do believe more programmer/scripter oriented tools tend to not do that, or at least let you request it to keep specific chunks. I'd imagine PNG-specific tools also do things properly here.
User avatar
MartinHowe
Posts: 2040
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom

Re: Batch tool to list grAb values to console output

Post by MartinHowe »

Thanks @Caligari87; pngchunks was what I needed. I built it from source and stripped out everything except grAb recognition, to output like this:

wine ~/Desktop/GrAbPNG.exe -console -grab 64 32 meow.png

I can append every such line to a script then source it.

Yes this is a gross hack, but it will do for now :P
User avatar
MartinHowe
Posts: 2040
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom

Re: Batch tool to list grAb values to console output

Post by MartinHowe »

While on the subject, I noticed that the default vertical offset for most monster sprites is their baseline is at -5; however, if you shoot a Zombieman then when his corpse is on the floor, you can't see the bottom of his body; this seems to be ZDoom's FLOORCLIP flag in action.

But I thought it was only supposed to do that on liquid textures? If I kill a Zombieman on E1M1 on the blue carpet area, it still happens :?

Can anyone tell me what is the reason for this?
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space

Re: Batch tool to list grAb values to console output

Post by NeuralStunner »

In OpenGL, sprites are just flat planes and will clip into the floor. GZDoom adjusts the Y offset to avoid this, but by default if a certain percentage of the sprite is below the floor it won't adjust it.

Return to “Creation, Conversion, and Editing”