Page 1 of 1

PSD to PNG keep size

Posted: 2010-07-13T06:48:22-07:00
by sfg
Hi,

I'm trying to convert the layers from a psd file, each in a png on its own. The problem I have is that the layers don't fill the canvas, so each png file is created with a different size, depending on how much graphics is on them. I need them to keep the same size as the psd, their exact position and the transparency too.

Re: PSD to PNG keep size

Posted: 2010-07-13T07:29:06-07:00
by snibgo
You might post a URL to the PSD.

Do a "identify -verbose" on the output PNGs. You might find each has a virtual canvas, and a "-flatten" on each will do the job.

Re: PSD to PNG keep size

Posted: 2010-07-13T07:50:20-07:00
by sfg
OK, here's a link: http://rapidshare.com/files/406731031/b ... 3.zip.html

Wouldn't flatten remove the transparency, though?

And keep in mind that I need the graphics to be in exact the same position as they are in the psd. For example, if I had a layer with just on pixel on it at the position 10x10, and the psd file has a size of 84x84, I need the resulting png to be 84x84 in size and that pixel to be at 10x10.

Re: PSD to PNG keep size

Posted: 2010-07-13T08:36:16-07:00
by snibgo
Flatten needs a suitable background, such as "None" for transparent.

The following Windows script might do what you want. The first convert creates file ba-1.png etc. There may be a single-command solution.

Code: Select all

convert bigarrow.psd -layers TrimBounds ba.png
for %%f in (ba*.png) do convert %%f -background None -flatten %%f

Re: PSD to PNG keep size

Posted: 2010-07-13T08:53:51-07:00
by sfg
Perfect, man! Thank you!