Convert multilayer PSD file has issues with layering

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
stallion

Convert multilayer PSD file has issues with layering

Post by stallion »

if I run

convert myfile.psd myfile.png

this will make 1 png layer file for each layer in the psd.

The problem is.

The layers that come out myfile.png.* are all over the place, In fact they seem centered on the layer from photoshop. I am pretty certian this has to do with the fact that the layers in photoshop are all over the pace. But I am wondering if there is a way to have imagemagic just use a relative canvas size and offsetting rather than the wonkey canvas size that photoshop is using to produce layer files that have the same relative position as it does in photoshop. IE offset the layers in the same size and position as they are in photoshop.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Try adding +repage to your command line to reset the page offset.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

It may also be that your png viewer does not show the offsets of your image.

If the offsets are important to you you can expand each layer to the full canvas
of the first frame image by using this spacial multi-image flatten formula.
convert myfile.psd -set dispose Background -coalesce myfile_%d.png

This will generat multiple images as your previous command probably did.

See 'Coalesce, as a progressave flatten'
http://www.cit.gu.edu.au/~anthony/graph ... /#coalesce

The other sections on that page should also be useful to know too.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
stallion

Hmm that seems like it will work

Post by stallion »

I get unkown oftion -set.

% convert -version
Version: ImageMagick 6.0.7 03/21/05 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2004 ImageMagick Studio LLC

What version do I have to upgrade to.

The RPM on the site says I have to be using Fedora core 5 is it ok If I am using 4.
stallion

there is a -dispose

Post by stallion »

I tried

convert myfile.psd -dispose Background -coalesce Staircase_to_dungeontestdarin.%d.png


and that seems to do the same thing as
convert myfile.psd -coalesce Staircase_to_dungeontestdarin.%d.png


which I think may be because the man page says

-dispose <method>
GIF disposal method

I am using psd though not gif. Which I do want each layer as a seperate file. and according to the link the -set dispose Background does.
stallion

-set only available in new version

Post by stallion »

Right I compiled from source Image Magick and -set is there and your command does indeed do what I want.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

I get unkown oftion -set.

Yes IM is too old for that option.

You will have to set the global dispose setting before reading the image sequence using

Code: Select all

convert -dispose Background myfile.psd -coalesce myfile_%d.png 
the -set version is for replaceing the dispose setting after the image has been read in. This should still work for any image format.

The -coalesce method is just a special one that has the side effect of allowing you to flatten a multi-image sequence to a transparent background.

Hmmm OKay you then upgraded. So you should have no further problems.
Look at the IM examples web page I pointed to for more info.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
stallion

Hmm I was all excited

Post by stallion »

It seemed to work great on my test cases. So I started trying larger more complicated Photoshop files with more layers and more effects. Many many photoshop files just run forever. I tried leaving one running overnight and in the morning it was still running for more than 12 hours. So I think its safe to say it would not finish.

Are there any rules that I can have people follow in photoshop to make it so that image magic will be able to extract the layer files. Unfortunatly I cannot post any files to try since they are for use in something which has not been released to the public yet.
stallion

A Thought

Post by stallion »

What If I made people flatten everything into less than ten layers. Are there a list of effects which are ok to use?
stallion

Photoshop settings

Post by stallion »

Playing with the setting in photoshop often makes this stuiff work
Post Reply