Encoding a PSD

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?".
Posts: 4
Joined: 2018-11-19T04:11:01-07:00
Authentication code: 1152

Encoding a PSD

Post by owo »

Couple quick questions about encoding PSDs.

1 - Every layer I generate seems to have a "Lock transparent pixels" lock set on it. Is there a way to turn that off for some layers? Can I lock other layers entirely?

2 - Is it possible to replace the thumbnail layer with a completely blank layer? The PSDs we generate are very large and we want to cut down on the size of it however possible even if it means the file takes a little longer to open while PS regenerates the preview.

3 - How do I enable ZIP compression? It seems to still use RLE even when I set ZIP:

Code: Select all

Is this meant to be set on every individual image, or is there some way I'm supposed to tell it that the multilayered PSD as a whole should be compressed?

4 - Can I resize an image but still have the entire untouched image saved in the PSD? I want to resize the images to be smaller, but still leave the option for us to go in Photoshop and resize them back to their full size later on without having lost quality. I'm pretty sure the Transform tool in Photoshop works like this but am not sure if it's possible to do it in IM.

5 - Sometimes we have a PSD where the front layer is entirely black and white but the layers behind them aren't. We want to preserve the color information of those layers in the back, but it seems IM detects that the viewable canvas is all black and white and forces a grayscale colormode on the document. Is there a way to override this?

I've on version 6.9.7-4 Q16 and have tried:

Code: Select all

	$psd->setOption('colorspace:auto-grayscale', 'off');
as well as setImageType, setImageColorspace, transformImageColorspace, and any and all variations of these options on the top layer itself vs set on the Imagick object holding the entire PSD before any files are loaded, and none of these seem to work; right now we're changing a single pixel on the top layer to a 1% opacity color, but ideally we don't want to touch the image.

Thank you!!

Posts: 4
Joined: 2018-11-02T16:08:20-07:00
Authentication code: 1152

Re: Encoding a PSD

Post by jb123 »

Hi owo,

I don't have any good answers but ran into the same issues. Wondering if you were able to figure out solutions to any of the problems you have posted.
Specifically the "locked transparency" one, and forced grayscale.



User avatar
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Encoding a PSD

Post by fmw42 »

I will defer to the Imagemagick developers.

But Imagemagick has rather primitive PSD capabilities. Most of what you want to do will likely need to be done in Photoshop.

As best I know:

1) Imagemagick cannot unlock alpha channels and cannot use more than one at this time. It will likely use the first one even if locked.

2) Imagemagick cannot replace the thumbnail

3) I do not know if you can use different transparencies. If -compress does not work, then I doubt it can be used currently.

4) This may be possible. See the -define section of options page at https://imagemagick.org/script/command- ... php#define
psd:additional-info=all|selective This option should only be used when converting from a PSD file to another PSD file. This should be placed after the image is read. The two options are 'all' and 'selective'. The 'selective' option will preserve all additional information that is not related to the geometry of the image. The 'all' option should only be used when the geometry of the image has not been changed. This option is helpful when transferring non-simple layers, such as adjustment layers from the input PSD file to the output PSD file. If this option is not used, the additional information will not be preserved. This define is available as of Imagemagick version 6.9.5-8.
See also
psd:preserve-opacity-mask=true This option should only be used when converting from a PSD file to another PSD file. It will preserve the opacity mask of a layer and add it back to the layer when the image is saved. Setting this to 'true' will enable this feature. This define is available as of Imagemagick version 6.9.5-10.
If on Linux, do not trust the version number. They often patch without changing the version number. But check the date of the version and compare to the version on the changelog page at https://legacy.imagemagick.org/script/changelog.php

Post an example and I can test that in the command line. Other APIs may not understand the define.

5) Post an example where the front layer is black and white. We do not know what this means, especially if you did not intentionally create it that way.