I'd like to glamorize a photo using image magick commandline tools. The following algorithm is what I use in GIMP:
1. Make a duplicate layer.
2. Change the duplicate layer to Overlay mode.
3. Apply gaussian blur to the duplicate layer
4. Increase brightness of both layers by 15%
5. Flatten the image
6. Write it out
I tried doing this as follows (skipping step 4 for now):
convert -gaussian-blur 15 original.tif blurred.tif
convert original.tif blurred.tif -compose overlay glamour.tif
The problem is that glamour.tif has two images in it. I tried using -flatten but it doesn't work either.
Thanks in advance for any help.
--Michael
glamourizing a photo
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: glamourizing a photo
without seeing the image you are working on it is hard to know exactly. But for starters you forgot to add -composite.
For compositing see: http://www.imagemagick.org/Usage/compose/
You also need to put something in the alpha channel. So see
http://www.imagemagick.org/Usage/basics/#alpha
http://www.imagemagick.org/Usage/channels/
If you post your original and what you get from GIMP, myself or someone on this list should be able to help more.
For compositing see: http://www.imagemagick.org/Usage/compose/
You also need to put something in the alpha channel. So see
http://www.imagemagick.org/Usage/basics/#alpha
http://www.imagemagick.org/Usage/channels/
If you post your original and what you get from GIMP, myself or someone on this list should be able to help more.
Re: glamourizing a photo
I didn't see a way to post an image on this forum, so I put them on pbase:
Original:
http://i.pbase.com/o6/34/560434/1/11400 ... iginal.jpg
Desired:
http://i.pbase.com/o6/34/560434/1/11400 ... efinal.jpg
Thanks!
--Michael
Original:
http://i.pbase.com/o6/34/560434/1/11400 ... iginal.jpg
Desired:
http://i.pbase.com/o6/34/560434/1/11400 ... efinal.jpg
Thanks!
--Michael
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: glamourizing a photo
You are correct, you have to host the image elsewhere and link it in.
From your images, I don't see why you need to use an overlay. I can get very close with just the following:
convert glam_original.jpg -blur 0x0.6 -set option:modulate:colorspace HSB -modulate 115 glam_orig_b0p6_m115.jpg
I used -blur rather than -gaussian-blur as it is faster. It is a separable gaussian blur. The blur sigma was 0.6 pixels and amounts to an equivalent radius of about 1.8 pixels
I used -modulate in the HSB colorspace to increase the brightess. (It also allows you to change the saturation and hue, if you want).
See
http://www.imagemagick.org/script/comma ... s.php#blur
http://www.imagemagick.org/Usage/color/#color_mods
You need a very recent version of IM (6.5.3-7) to use the -set option to use HSB as the current -modulate uses HSL and will cause increased white along with increased brightness. However at some previous time (before 6.4.0-10) it was using HSB. Otherwise, Anthony has shown how to achieve the same HSB or HSL effect without the use of -set.
From your images, I don't see why you need to use an overlay. I can get very close with just the following:
convert glam_original.jpg -blur 0x0.6 -set option:modulate:colorspace HSB -modulate 115 glam_orig_b0p6_m115.jpg
I used -blur rather than -gaussian-blur as it is faster. It is a separable gaussian blur. The blur sigma was 0.6 pixels and amounts to an equivalent radius of about 1.8 pixels
I used -modulate in the HSB colorspace to increase the brightess. (It also allows you to change the saturation and hue, if you want).
See
http://www.imagemagick.org/script/comma ... s.php#blur
http://www.imagemagick.org/Usage/color/#color_mods
You need a very recent version of IM (6.5.3-7) to use the -set option to use HSB as the current -modulate uses HSL and will cause increased white along with increased brightness. However at some previous time (before 6.4.0-10) it was using HSB. Otherwise, Anthony has shown how to achieve the same HSB or HSL effect without the use of -set.
Re: glamourizing a photo
Although I agree that your suggestion is very quick, it doesn't give as pleasing a result. The colors are too dull.
Using your suggestion to include -composite in the command, I was able to come up with something that works pretty well. Here it is as Tcl code
set blur 15
set gamma 1.2
set sigma [expr $blur/3.0]
set tmpRoot /tmp/glam-[pid]
exec convert -blur ${blur}x${sigma} -gamma $gamma $input $tmpRoot.1
exec convert -gamma $gamma $input $tmpRoot.2
exec convert $tmpRoot.1 $tmpRoot.2 \
-compose overlay -composite [file rootname $input]-Glam.tif
file delete -force $tmpRoot-1.tif $tmpRoot-2.tif
Just to review. Th e original looked like this:
The GIMP-processed image was like this:
Your suggestion looks like this:
My new sequence gives this:
Overall, I still like the GIMP result best, but the model likes the last image best. For me it is a little too contrasty.
Thanks for your help!
--Michael
Using your suggestion to include -composite in the command, I was able to come up with something that works pretty well. Here it is as Tcl code
set blur 15
set gamma 1.2
set sigma [expr $blur/3.0]
set tmpRoot /tmp/glam-[pid]
exec convert -blur ${blur}x${sigma} -gamma $gamma $input $tmpRoot.1
exec convert -gamma $gamma $input $tmpRoot.2
exec convert $tmpRoot.1 $tmpRoot.2 \
-compose overlay -composite [file rootname $input]-Glam.tif
file delete -force $tmpRoot-1.tif $tmpRoot-2.tif
Just to review. Th e original looked like this:
The GIMP-processed image was like this:
Your suggestion looks like this:
My new sequence gives this:
Overall, I still like the GIMP result best, but the model likes the last image best. For me it is a little too contrasty.
Thanks for your help!
--Michael
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: glamourizing a photo
stinky-tofu wrote:I'd like to glamorize a photo using image magick commandline tools. The following algorithm is what I use in GIMP:
1. Make a duplicate layer.
Code: Select all
convert image \( +clone \
later2. Change the duplicate layer to Overlay mode.
3. Apply gaussian blur to the duplicate layer
Code: Select all
-blur 5 \) \
4. Increase brightness of both layers by 15%
Code: Select all
-modulate 115 \
5. Flatten the image
Code: Select all
-compose overlay -composite \
6. Write it out
Code: Select all
result
Code: Select all
convert image \( +clone -blur 5 \) -modulate 115 \
-compose overlay -composite result
Do you have a reference for the technique? Or an appropriate source image which it is ment to be applied to? It sounds like a good technique to list in Im examples Photo Cookbook
http://www.imagemagick.org/Usage/photos/#cookbook
I did not use flatten as only two images were involved, and flatten generates a thrid image using the background color! It is not needed in this case.
So you want the images to remain separate or merge them together before hand?The problem is that glamour.tif has two images in it.
This variation keeps them separate, using some image list handling and the -layers compose to merge the two separate list of images. The two list are marked by the special 'null:' image
see http://www.imagemagick.org/Usage/anim_mod/#composite
Code: Select all
convert image null: \( -clone 0--2 -blur 5 \) -modulate 115 \
-compose overlay -layers composite result
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/