Automation of PSD lanyards with ImageMagick

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
harvinder161
Posts: 4
Joined: 2018-10-04T21:42:29-07:00
Authentication code: 1152

Automation of PSD lanyards with ImageMagick

Post by harvinder161 »

I have few PSD lanyard mockups like these http://graficzny.com.pl/mockup-smycz/
Here if i edit layer1 image from photoshop then whole lanyard design changes automatically. Now I want to do this programmatically using ImageMagick on my server. Is it possible that i upload the base image from web, then it creates lanyard according to mockup and show it to user. Pardon my bad English
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Automation of PSD lanyards with ImageMagick

Post by fmw42 »

I have worked with Imagemagick to process PSD files. Can you post an example PSD file and identify what you want changed. You can post to some free hosting service such as dropbox.com that will not change you image format. Then put the URL here.

___________________________________

Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
harvinder161
Posts: 4
Joined: 2018-10-04T21:42:29-07:00
Authentication code: 1152

Re: Automation of PSD lanyards with ImageMagick

Post by harvinder161 »

Thanks for reply fmw42 .

Here is a sample PSD ( https://www.dropbox.com/s/8nlpnwx4771uw ... 1.psd?dl=0 ) which I want to automate.Here is also a video of procedure that is currently done manually.
https://www.dropbox.com/s/fkojc6xaqxleh ... d.mp4?dl=0
In the video if we edit image of Layer 1 whole lanyard design gets changed. Now, to automate, user can just upload the base image ( the smart object which we edited in layer 1) and user can download the final design .

Hope this clarify the requirement.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Automation of PSD lanyards with ImageMagick

Post by fmw42 »

I am not 100% sure about this, but I do not think Imagemagick can do what you want. It is very limit in its PSD file processing and knows little about smart layers, adjustment layer, group layers, etc.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Automation of PSD lanyards with ImageMagick

Post by Bonzo »

As I understand it fmw42 the OP wants to map the flat image to the lanyard image and as it will be online there will not be any Photoshop interaction.

I suppose it would be similar to the T shirt code although I have no idea how it would cope with going under and over. I noticed the Original Lanyard image had a grid where the flat image was to be placed.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Automation of PSD lanyards with ImageMagick

Post by fmw42 »

Bonzo wrote: 2018-10-06T11:10:09-07:00 As I understand it fmw42 the OP wants to map the flat image to the lanyard image and as it will be online there will not be any Photoshop interaction.

I suppose it would be similar to the T shirt code although I have no idea how it would cope with going under and over. I noticed the Original Lanyard image had a grid where the flat image was to be placed.
Perhaps I misunderstand. But I do not think he can extract that layer, modify it and put it back, since it is part of a smart layer. But then I am not a Photoshop expert, especially with regard to smart layers. If all the layers were simple, then I think it could be done.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Automation of PSD lanyards with ImageMagick

Post by fmw42 »

I confirmed with Dirk that Imagemagick cannot handle smart layers at this time.

In fact, I tried converting your PSD to a new PSD and opened it in Photoshop and saw that it now had a lot of normal layers and not the smart layers.

Code: Select all

convert Lanyard_Mockup_1.psd -define psd:additional-info=all new.psd
See https://imagemagick.org/script/command- ... php#define
harvinder161
Posts: 4
Joined: 2018-10-04T21:42:29-07:00
Authentication code: 1152

Re: Automation of PSD lanyards with ImageMagick

Post by harvinder161 »

Bonzo wrote: 2018-10-06T11:10:09-07:00 As I understand it fmw42 the OP wants to map the flat image to the lanyard image and as it will be online there will not be any Photoshop interaction.

I suppose it would be similar to the T shirt code although I have no idea how it would cope with going under and over. I noticed the Original Lanyard image had a grid where the flat image was to be placed.
Thanks for reply Bonzo. You understood the problem correctly. I saw this example mentioned in your post http://www.fmwconcepts.com/imagemagick/tshirt/index.php. It can work if we
1) Start with background image (https://www.dropbox.com/s/9xia5pcneu12p ... k.png?dl=0) , which i will upload for each template

2) Create overlay image (https://www.dropbox.com/s/9xia5pcneu12p ... k.png?dl=0) from base image (https://www.dropbox.com/s/t2wz3y1t6djdc ... e.png?dl=0) using ImageMagick

3) Merge background with overlay using ImageMagick

Is it possible in ImageMagick to do point number 2 ?
harvinder161
Posts: 4
Joined: 2018-10-04T21:42:29-07:00
Authentication code: 1152

Re: Automation of PSD lanyards with ImageMagick

Post by harvinder161 »

fmw42 wrote: 2018-10-06T16:43:33-07:00 I confirmed with Dirk that Imagemagick cannot handle smart layers at this time.

In fact, I tried converting your PSD to a new PSD and opened it in Photoshop and saw that it now had a lot of normal layers and not the smart layers.

Code: Select all

convert Lanyard_Mockup_1.psd -define psd:additional-info=all new.psd
See https://imagemagick.org/script/command- ... php#define
Thanks for reply fmw42. Is it possible to edit Lanyard_Mockup_1.psd base image (https://www.dropbox.com/s/t2wz3y1t6djdc ... e.png?dl=0 in current example) before converting it to new.psd ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Automation of PSD lanyards with ImageMagick

Post by fmw42 »

Is it possible to edit Lanyard_Mockup_1.psd base image (https://www.dropbox.com/s/t2wz3y1t6djdc ... e.png?dl=0 in current example) before converting it to new.psd ?
What do you consider the base image? When I convert your PSD to a new PSD, I get lots of yellow layers, one for each section of the lanyard.

I can export the flattened layer from each and get the same PNG result.

Code: Select all

convert Lanyard_Mockup_1.psd[0] test1.png
So you could expert all the layers from the PSD to PNG, modify (not sure how?) and then put them back into a new PSD. But it would have simple layers and not smart layers.

I cannot say whether that would work or not for what you want to do. All you can do is try and see.
Post Reply