PSD to PNG keep size

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sfg
Posts: 17
Joined: 2009-12-30T13:44:31-07:00
Authentication code: 8675309

PSD to PNG keep size

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD to PNG keep size

Post 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.
snibgo's IM pages: im.snibgo.com
sfg
Posts: 17
Joined: 2009-12-30T13:44:31-07:00
Authentication code: 8675309

Re: PSD to PNG keep size

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD to PNG keep size

Post 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
snibgo's IM pages: im.snibgo.com
sfg
Posts: 17
Joined: 2009-12-30T13:44:31-07:00
Authentication code: 8675309

Re: PSD to PNG keep size

Post by sfg »

Perfect, man! Thank you!
Post Reply