Making a soft dark vignette on edges or burning the edges

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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Making a soft dark vignette on edges or burning the edges

Post by javismiles »

dear friends,
i am stuck after days on a couple of things, maybe you can help me

- the -vigette command in imagemagick, i understand that i can make -background none before to make it transparent, but what i want is to just darken the edges of the image a bit, neither full black neither full transparent, basically how can i slightly burn the edges of an image, darken them a bit, a soft dark vignette,
i dont seem to find the combinations to do this; what i need is a dark vignette but semitransparent, soft, or any other way to burn to darker the edges of an image?

- if i compose two jpeg images together, is there any way to create a mask on the fly (with gradient or circle), and apply it to the compositing process?
when they are both jpegs?

my main problem is the first one of the vignette in any case,
i have tried every combination of the parameters and i dont find what i need, the vignette is always too strong,
and making background none and transparent is not what i need, that makes the vignette go to white, not to dark
how can i basically darken the edges of a picture, but not totally, just a bit, there must be a way

is it the only way to declare a dark background and do a vignette? isnt there other ways to darken the edges of an image a bit?

thank you very much

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

Re: Making a soft dark vignette on edges or burning the edge

Post by fmw42 »

try this (adjust the gray percent to make the edge darker or lighter)


convert yourimage \( +clone -fill white -colorize 100 -background "gray(50%)" -vignette 0x5 \) -compose multiply -composite resultimage


You might also be interested in my imageborder script at the link below
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Making a soft dark vignette on edges or burning the edge

Post by javismiles »

Fred
thank you so much for trying to help me,
i just tried your line of code,
but all i get is a very hard and black vignete around, mmm,
is it because im using only Jpegs? but i need to do it only with jpegs, not pngs,
i used this
( +clone -fill white -colorize 100 -background 'gray(50%)' -vignette 0x5 ) -compose multiply -composite
but im getting a black hard vignette instead of a soft semitransparent one

thank u
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Making a soft dark vignette on edges or burning the edge

Post by javismiles »

by the way, just checked your page of scripts,
thats totally awesome, what a fantastic page,
i use imagemagick directly from PHP, are your scripts adaptable to translate them to php or how can they be used from php? thank you

i keep trying the vignette issue mmm, i need with jpeg source and output, to be able to darken the edges but not fully to black just a bit, soft, soft
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Making a soft dark vignette on edges or burning the edge

Post by javismiles »

oh my
you are a genious
it works!! all i needed is to change the color to the syntax -background #bbbbbb
for some reason it didnt work with the (grey) syntax
wow, thank you SO MUCH, it works!!!

as you are such an expert, any idea of my second issue

i have an image whose size changes dynamically, jpeg, and i need to put another image on top of it, same size, but mask it with an oval so that only the sides of the top image are seen, can i create dynamically a centered oval mask to use with the second image over the first? being all jpeg?
thank u SO much :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Making a soft dark vignette on edges or burning the edge

Post by fmw42 »

this works fine for me on IM 6.6.7.7 Q16 Mac OSX Tiger. try using double quotes. see color definitions at http://www.imagemagick.org/script/color.php

Are you on windows? If so changes are needed. see http://www.imagemagick.org/Usage/windows/


Image

convert zelda3.jpg \( +clone -fill white -colorize 100 -background "gray(50%)" -vignette 0x5 \) \
-compose multiply -composite zelda3_vignette.jpg

Image


My scripts work in PHP with the exec command.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Making a soft dark vignette on edges or burning the edge

Post by fmw42 »

i have an image whose size changes dynamically, jpeg, and i need to put another image on top of it, same size, but mask it with an oval so that only the sides of the top image are seen, can i create dynamically a centered oval mask to use with the second image over the first? being all jpeg?
Both images need to be the same size


Image

Image

convert zelda3.jpg checks.jpg \( +clone -fill white -colorize 100 -background black -vignette 0x0 -negate \) \
-compose over -composite zelda3_checks.jpg

Image
Last edited by fmw42 on 2011-02-19T22:45:15-07:00, edited 1 time in total.
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Making a soft dark vignette on edges or burning the edge

Post by javismiles »

thank you so much, yes im on windows, you are right,

and yes, the two images are the same size (on the second case),
im gonna try now this that you wrote
convert zelda3.jpg checks.jpg \( +clone -fill white -colorize 100 -background black -vignette 0x0 -negate \) \
-compose over -composite zelda3_checks.jpg

by the way, is vignette the only way to do it, will it use too much processing as opposed to draw a circle or something, thing is that in the same operation i may need to do a real vignette as well, so i would be executing twice the vignette thing, maybe too much processing, but i guess if you wrote it is because its the faster way
to do what i asked i guess,

thank u so much im gonna try it :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Making a soft dark vignette on edges or burning the edge

Post by fmw42 »

See using my scripts with PHP on my home page below.

I don't know much about PHP on Windows, but in command line there are differences such as no \ before parenthesis and line continuations are ^ rather than \ and you may need different quotes. See the link I mentioned above.

For PHP (and a Windows user), see Rubblewebs website at http://www.rubblewebs.co.uk/index.php under his Imagemagick link

You can also draw a circle on a background using the same concept of +clone -fill somecolor -colorize 100 to get that color background of the size you need where somecolor is black and then draw a white circle/ellipse (or the other way around) as desired and optionally blur it for a vignette effect. I don't know which will be faster. The only issue with this is you need to know the size of the image to draw the desired size circle/ellipse. But that may not be an issue under PHP as you can get the image size first. The advantage is that you have more control over size and shape when using -draw.


The reason your "gray(50%)" did not work, if you were doing it in PHP, was likely that the quotes need to be escaped in PHP.
Last edited by fmw42 on 2011-02-19T22:46:05-07:00, edited 1 time in total.
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Making a soft dark vignette on edges or burning the edge

Post by javismiles »

the mask works also :)
your help is fantastic and im very grateful :)
from today i am fan of your scripts as well :)

thank you :)
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Making a soft dark vignette on edges or burning the edge

Post by javismiles »

Fred, quick last question,

how would you do a cross-treatment command?
or basically any command that pushes the shadows and highlights of an image in different directions?
like pushing the shadows of an image towards blue and the highlights towards orange,
or the shadows towards green and the highlights towards red, etc treatments that instead of
tinting the image uniformly in 1 direction, they do so in 2 directions,

and if simulating a cross-processing treatment then they would increase contrast at the same time

thank u very much
jav
:)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Making a soft dark vignette on edges or burning the edge

Post by fmw42 »

That is a hard one. Off the top of my head, you would have to make masks to separate the highlights and shadows and midtones. Then use -modulate to change the colors of the image each way you want, once for the shadows another time for the highlights, plus the original image for midtones. Then you would have to composite them all together using the masks. This is similar to what I did with my duotone script, except rather that brightness/contrast adjustment it would be color changes.

Perhaps Anthony might have some good thoughts.

I would need a good example image to test that process. Can you post one and explain what you want to happen?
Post Reply