mimic series of photoshop layer styles

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
fluxist8070
Posts: 4
Joined: 2014-08-01T16:51:37-07:00
Authentication code: 6789

mimic series of photoshop layer styles

Post by fluxist8070 »

Hi,
I am a new IM user and have been hacking around and checking docs for around 30 or so hours. I have some questions.
There is a specific output from PS I would like to mimic. Here is an example-

Image

The only diffeences in the reference, I'll need a transparent background. Which, is totally doable.

Here is the command line code I've got so far, I'm using IM for windows. (Side question, is IM for linux better for any reason?)-

Code: Select all

convert Hawk.jpg -transparent white -fill #C3C3C3 -opaque #000000 -resize 300X300 -shade 220X45 hawkGlass.png
This gives me this output so far-

Image

Things I'm having trouble with-

converting a jpg to a png and then changing the image(transparent background, shade, etc); adding a drop shadow. I'm a little confused about the clone command. I know the examples are in Unix and I'm not sure about the syntax for Windows cmd.

I appreciate any help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mimic series of photoshop layer styles

Post by fmw42 »

I know the examples are in Unix and I'm not sure about the syntax for Windows cmd.
Most things are the same for Windows and Unix. Some things like line ending are different if you want to continue to another line in the same command. Unix uses \ and Windows ^. Similarly if you want to escape some character, Unix uses \ and Windows ^. In Unix all parenthesis need escaping. In Windows this is not necessary. In Unix, colors need double quotes. I don't think that is needed for Windows.

I am not a Windows user, so some Windows expert can give you more comments. But do see http://www.imagemagick.org/Usage/windows/


I have quite a few unix bash shell scripts for IM at my link below. But they can be run on Windows with Cygwin installed. See http://im.snibgo.com/cygwin.htm

If you post your input image, we can probably help you work out commands to closely match what you can do in Photoshop.


The clone command is used to duplicate some previous image (or processed image) and needs to be used in parenthesis. It is the combination that is what allows you to process an image multiply times and then later combine them. See

http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/basics/#clone
http://www.imagemagick.org/Usage/basics/#seq_combine
http://www.imagemagick.org/Usage/basics/#complex
http://www.imagemagick.org/Usage/files/#write
http://www.imagemagick.org/Usage/layers/ and especially
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/compose/
fluxist8070
Posts: 4
Joined: 2014-08-01T16:51:37-07:00
Authentication code: 6789

Re: mimic series of photoshop layer styles

Post by fluxist8070 »

Thank you for the reply!
Here is the default image I'm working with.

Image

I've seen most of these links.
I guess what I was confused about is how the slashes and parens translate in windows. Thanks for the help on that!

So if I want to convert a jpg to a png and then edit the image in the command line, I can to that by formatting in the karats for the slashes and I should be good to go right?

Thanks again!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mimic series of photoshop layer styles

Post by fmw42 »

So if I want to convert a jpg to a png and then edit the image in the command line, I can to that by formatting in the karats for the slashes and I should be good to go right?
Not sure what you are asking. Perhaps post a command line for reference.

But there is no need to first convert the jpg to png. It is done simply by reading in the jpg and using png for the suffix of the output.

Any thing you need to do with parens, do not need ^. But if you want to split a very long command into multiple lines for readability, you need to end each line with ^.

Sor for example

Code: Select all

convert image.jpg ^
( -clone 0 ...some processing... ) ^
( -clone 0 ...some processing... ) ^
-compose over -composite ^
result.png
Try this command.

I added -blur to make the bevel wider. I negate the image so that the alpha channel is the correct polarity. I use -alpha copy to add the alpha channel as a copy of the negated image. I turn alpha off so that the alpha channel is not blurred, then turn it back on at the end.

Code: Select all

convert hawk.jpg -resize 300x300 -negate -alpha copy -alpha off -blur 0x2 -shade 220X45 -alpha on hawk_bevel.png
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: mimic series of photoshop layer styles

Post by snibgo »

On Unix to Windows: technically, these aren't differences between Unix and Windows. These are differences between the bash shell and the cmd shell. You can run bash under Windows. There is probably a version of cmd for Unix, but no sensible person would want to do that. Windows comes supplied with shells other than cmd (eg Powershell).

Anyhow: the other main difference is that Windows cmd scripts, when run in a BAT file, need every percent sign % doubling. This is to avoid confusion with the script parameters %1, %2 etc that are not doubled.

Yes, as a rule of thumb: to convert an ImageMagick Unix command into a Windows command, replace every caret ^ with a backslash \, and double every percent %.
snibgo's IM pages: im.snibgo.com
fluxist8070
Posts: 4
Joined: 2014-08-01T16:51:37-07:00
Authentication code: 6789

Re: mimic series of photoshop layer styles

Post by fluxist8070 »

Works Great!
Made some tweaks based on your advice-

Code: Select all

convert hawk.jpg -resize 300x300 -negate -alpha copy -alpha off -blur 0x2 -shade 720X60 -alpha on ( -clone 0 -background black -shadow 100x1+10+10 ) -compose Dst_Over -composite hawkGlass.png
Is there a way to add transparency to the whole image? I know you can set an alpha to do transparency and do an overlay layer, but I might need a value to tweak it.

Thanks again! You've saved me a ton of time and help me to get better at this. So I definitely appreciate it!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mimic series of photoshop layer styles

Post by fmw42 »

not quite sure what you are asking? do you just want to reduce the overall alpha value? if so, this will reduce by half. It just turns on only the alpha channel, multiplies by 0.5, then turns on all channels. Windows syntax with new lines


convert hawk.jpg -resize 300x300 -negate -alpha copy -alpha off -blur 0x2 -shade 720X60 -alpha on ^
( -clone 0 -background black -shadow 100x1+10+10 ) -compose Dst_Over -composite ^
-channel a -evaluate multiply 0.5 +channel hawkGlass2.png
fluxist8070
Posts: 4
Joined: 2014-08-01T16:51:37-07:00
Authentication code: 6789

Re: mimic series of photoshop layer styles

Post by fluxist8070 »

Yep. That was it! I'm used to multiply also darkening the image. I didn't realize that in IM it just makes it transparent.
Thanks for your time and help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mimic series of photoshop layer styles

Post by fmw42 »

fluxist8070 wrote:Yep. That was it! I'm used to multiply also darkening the image. I didn't realize that in IM it just makes it transparent.
Thanks for your time and help!
You have to select only the alpha channel for that. With -channel you can select which combination of channels you want to work on. You must remember to turn them all back on afterwards.
Post Reply