Create PSD with IM with locked layers

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?".
OlgerD
Posts: 15
Joined: 2015-06-01T21:53:02-07:00
Authentication code: 6789

Create PSD with IM with locked layers

Post by OlgerD »

Hi Guys,
In Photoshop, one can lock layers to prevent them from being edited. I know how to create a psd file with IM as follows:

Code: Select all

convert ( -label "top" image1.png -background none -mosaic ) ( -label "middle" image2.png -background none -mosaic ) ( -label "background" image3.png -mosaic ) ( -clone 0--1 -mosaic ) -reverse "output.psd"
which works well, but is there a way to lock specific layers (ie, the top and middle) so that they can't be edited in PS unless they unlock it? I'm not looking to password protect the layer, only being able to lock it to prevent accidental changes, unless whoever is working on it in PS intends to change the locked layers.
Thanks!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Create PSD with IM with locked layers

Post by dlemstra »

This sounds like a good idea. I could add a define for this. I will get back to this topic after it has been implemented.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
OlgerD
Posts: 15
Joined: 2015-06-01T21:53:02-07:00
Authentication code: 6789

Re: Create PSD with IM with locked layers

Post by OlgerD »

That would be awesome!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Create PSD with IM with locked layers

Post by dlemstra »

Can you add a link to a psd file that contains a locked layer?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
OlgerD
Posts: 15
Joined: 2015-06-01T21:53:02-07:00
Authentication code: 6789

Re: Create PSD with IM with locked layers

Post by OlgerD »

https://www.dropbox.com/s/m6ptt9r9xb1h1 ... t.zip?dl=0
First 2 layers are locked (labelled 'guidelines' and 'cropmarks'), background layer (labelled 'Image') is unlocked.
OlgerD
Posts: 15
Joined: 2015-06-01T21:53:02-07:00
Authentication code: 6789

Re: Create PSD with IM with locked layers

Post by OlgerD »

dlemstra wrote:Can you add a link to a psd file that contains a locked layer?
I've created another 2 psd files linked here: https://www.dropbox.com/s/hiwn68wcndpc6 ... D.zip?dl=0
Both psd files are identical except that in one psd file both layers are unlocked, and in the other layer2 is locked and layer1 is unlocked. I figure a smaller psd file (each layer is 1x1 inch and has a dpi of 100) is easier to work with.

Interestingly, as I was creating the psd files, I noticed something different with the lock icons in Photoshop. When creating layers in photoshop, layers are by default unlocked and show no lock icon. When creating a psd file with IM, each layer (when opening in photoshop) shows a lighter grey lock icon, but is not locked. I have to select the layer in photoshop, then click the lock to actually lock the layer, and then the lock becomes a darker color.
pfranz
Posts: 2
Joined: 2016-11-14T18:50:14-07:00
Authentication code: 1151

Re: Create PSD with IM with locked layers

Post by pfranz »

Was this ever integrated into ImageMagick and released? I can't find any reference to it.

I feel like I'm having the opposite issue. I'm using IM version 7.0.3-6. Photoshop CS 2015 has a few Layer locking types: Lock transparent pixels, Lock image pixels, Lock position, Prevent auto-nesting info and out of Artboards, and Lock all. By default "Lock transparent pixels" is on for my layers and I would like it off. I don't see any references for flags in IM (I've tried a bunch out of desperation). I don't see any references to it when I run "identify" on PSD files.

Here's the command I'm using to generate layers PSDs:

Code: Select all

convert \( -label "car" "car.png" -background none -compress RLE \) \
        \( -label "shadow" "shadow.png" -background none -compress RLE \) \
        \( -label "background xc:white -background white -compress RLE \) \
        \( -clone 0--1 -mosaic -compress RLE \) -reverse -profile "sRGB IEC61966021.icc" "out.psd"
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Create PSD with IM with locked layers

Post by dlemstra »

It looks like we always write the image with protected transparency. Not sure why we do that though. I created a couple of test images here: https://www.dropbox.com/sh/fktmbz34typ8 ... L4_fa?dl=0. I think c.psd is the correct one, b.psd has an invisible layer and a.psd has protected transparency. Can you or Fred confirm that this is correct?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create PSD with IM with locked layers

Post by fmw42 »

For me with my old PS CS:

a) shows the logo image -- lock is on, and lock icon shows partially locked

b) is fully transparent -- show (eye) icon is off

c) shows the logo image -- not locked (no lock icon)

However, Dirk, I still cannot display or identify these images on my Mac. I still get an abort trap. Did you ever fold that fix into the release?

P.S. Tried in both 6.9.6-4 and 7.0.3-6
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Create PSD with IM with locked layers

Post by dlemstra »

Wasn't the abort trap solved when you disabled OpenMP? And I don't really understand what partially locked means.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create PSD with IM with locked layers

Post by fmw42 »

dlemstra wrote:Wasn't the abort trap solved when you disabled OpenMP? And I don't really understand what partially locked means.
I do not either. I will check with openMP disabled and let you know. I thought you had sent me some code to test that fixed it back a few releases ago. But let me check on openMP.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create PSD with IM with locked layers

Post by fmw42 »

Yes, limiting the threads to 1 allows me to display a.psd. Sorry I forgot about that.

Photoshop Partially locked => Search Google and I get

Partially lock a layer
Select a layer.
Click one or more lock options in the Layers palette. Lock Transparency Confines editing to the opaque portions of the layer. This option is equivalent to the Preserve Transparency option in earlier versions of Photoshop.
But that does not clearly say what partially locked means.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Create PSD with IM with locked layers

Post by dlemstra »

I still don't understand why it fails on your machine though. Maybe we can have a debug session sometime?

And what does fully locked mean? I don't understand the difference.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create PSD with IM with locked layers

Post by fmw42 »

For locking see http://www.graphics.com/article-old/pho ... ansparency. It seems to explain it all.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create PSD with IM with locked layers

Post by fmw42 »

See my edited comments about the a,b,c psd files above regarding their states
Post Reply