Command Line PNG Trimming w/o loss of grAb chunk?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
exwizard
Posts: 46
Joined: Mon Jun 14, 2010 5:31 pm
Location: Vansterdam, BC

Command Line PNG Trimming w/o loss of grAb chunk?

Post by exwizard »

Hey folks,

I'm trying to finish a set of tools to automate ripping models (http://forum.zdoom.org/viewtopic.php?f=3&t=28313) but have run into an issue concerning batch trimming of PNG files. Essentially my problem is that I cannot use a command line image editor (currently using http://www.imagemagick.org/script/index.php) to trim transparent pixels without losing the grAb chunk. I'm somewhat lost in this area so any help would be appreciated. From the looks of the wiki, the very format of the grAb chunk should tell the tool to keep it, right? Then why does it keep getting lost?

This is the command I am entering; it successfully trims the image but loses the grAb chunk. I know the grAb chunk determines an offset from the top left of the image and even if it was kept it would be wrong after a trim but, after I get over this obstacle, I'm hoping to be able to modify the grAb chunk to adjust for the trimmed space.

Code: Select all

Mogrify -trim *.png
Any help would be appreciated.

Edit: 'GrAb' changed to 'grAb'

Edit2: I've also posed this problem on the imagemagick forums: http://forum.zdoom.org/viewtopic.php?f= ... 43#p544643
Last edited by exwizard on Sat Jan 29, 2011 7:29 am, edited 4 times in total.
Gez
 
 
Posts: 17939
Joined: Fri Jul 06, 2007 3:22 pm

Re: Command Line PNG Trimming w/o loss of GrAb chunk?

Post by Gez »

It's grAb, not GrAb.

The problem is that nobody bothers with standard-compliance wrt. custom chunks in the PNG world. Whether the case says "keep" or "remove", they always remove it.
User avatar
exwizard
Posts: 46
Joined: Mon Jun 14, 2010 5:31 pm
Location: Vansterdam, BC

Re: Command Line PNG Trimming w/o loss of GrAb chunk?

Post by exwizard »

Well, that blows.

(also, damn mediawiki and its forcing first letter capitalization of all entries)

Edit: Does anyone know of any program that respects keeping the grAb chunk? Does GIMP?

Edit2: It seems transferring the grAb info to the oFFs chunk, then mogrifying, and then transferring the oFFs data back into the grAb chunk is a viable workaround. I am going to experiment with that solution when I get some time and post results. If this works it could be a convenient way to optimize sprites.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Command Line PNG Trimming w/o loss of grAb chunk?

Post by Graf Zahl »

Sadly, people are just too lazy to code a simple 'unknown chunk container' into their tools. I haven't found a single PNG tool yet that doesn't destroy custom chunks.
Gez
 
 
Posts: 17939
Joined: Fri Jul 06, 2007 3:22 pm

Re: Command Line PNG Trimming w/o loss of GrAb chunk?

Post by Gez »

exwizard wrote:Edit: Does anyone know of any program that respects keeping the grAb chunk? Does GIMP?
No, and given the GIMP devs' attitude, I don't think it ever will.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Command Line PNG Trimming w/o loss of grAb chunk?

Post by Graf Zahl »

Too bad that there's no official certification of PNG support. If that existed a lot of tools would have to take 'PNG support' off their feature list because they all miss something.
Locked

Return to “Editing (Archive)”