MagickCompositeImage BlurCompositeOp UndefinedException
MagickCompositeImage BlurCompositeOp UndefinedException
I'm attempting to use the BlurCompositeOp composition method on the iPhone build (ImageMagick 6.6.7-0 2011-01-13 Q8 http://www.imagemagick.org).
status = MagickCompositeImage(magick_wand, clone, BlurCompositeOp, 0, 0);
status is always MagickFalse, the severity is UndefinedException and the description is empty. (well, the debugger shows it as "0 '\000'")
Over op works fine, but obviously doesnt get me where I want to go.
(I'm attempting to recreate the tilt-shift effect like http://www.imagemagick.org/Usage/photos/#tilt_shift)
Any help would be greatly appreciated. I'm pretty new to the MagickWand API. I wouldn't mind using the commandline converter, but I need to be able to populate the wand with the image bits, not have it read from a file.
Thanks!
status = MagickCompositeImage(magick_wand, clone, BlurCompositeOp, 0, 0);
status is always MagickFalse, the severity is UndefinedException and the description is empty. (well, the debugger shows it as "0 '\000'")
Over op works fine, but obviously doesnt get me where I want to go.
(I'm attempting to recreate the tilt-shift effect like http://www.imagemagick.org/Usage/photos/#tilt_shift)
Any help would be greatly appreciated. I'm pretty new to the MagickWand API. I wouldn't mind using the commandline converter, but I need to be able to populate the wand with the image bits, not have it read from a file.
Thanks!
-
- Posts: 2
- Joined: 2011-03-11T19:55:07-07:00
- Authentication code: 8675308
Re: MagickCompositeImage BlurCompositeOp UndefinedException
Hi has anyone had any luck with this, I ran into the same problem - actually trying to achieve the same effect as well
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: MagickCompositeImage BlurCompositeOp UndefinedException
I am not certain of what you are getting a bad Exception. You should be getting something.
Hmmm perhaps that should be reported in teh Bugs forum. (The exception, not your requested problem).
However....
The Blur Composite Op requires some extra data such as "Maximum Blur Sigma" which is passed to it via a "compose:args" artifact define. Without that operational control artifact the operation is incomplete.
Examples of the argument to control the bluring is in IM Examples, Mapping, Variable Blur Mapping
http://www.imagemagick.org/Usage/mapping/#blur
As well as in Phot Handling, Tilt Shift (where a lareg value of 20 is being used).
http://www.imagemagick.org/Usage/photos/#tilt_shift
The setting is added as a string 'Artifact' which is on the command line set using "-define ..." or "-set option:...", and should be added to at least the first (destination) image of the CompositeImage() function.
This is in lower level library MagicCore code I have used to do this...
I do not know how it should be applied in MagickWand, but it should be very similar.
Oh and don't forget to increase contrast first, and/or saturate the colors, so as to make the image look more artificial, like a model in a studio. That is a very important element of tilt-shift
Hmmm perhaps that should be reported in teh Bugs forum. (The exception, not your requested problem).
However....
The Blur Composite Op requires some extra data such as "Maximum Blur Sigma" which is passed to it via a "compose:args" artifact define. Without that operational control artifact the operation is incomplete.
Examples of the argument to control the bluring is in IM Examples, Mapping, Variable Blur Mapping
http://www.imagemagick.org/Usage/mapping/#blur
As well as in Phot Handling, Tilt Shift (where a lareg value of 20 is being used).
http://www.imagemagick.org/Usage/photos/#tilt_shift
The setting is added as a string 'Artifact' which is on the command line set using "-define ..." or "-set option:...", and should be added to at least the first (destination) image of the CompositeImage() function.
This is in lower level library MagicCore code I have used to do this...
Code: Select all
SetImageArtifact(composite_image,"compose:args", "10");
CompositeImage(composite_image,BlurCompositeOp,blur_mask,0,0);
Oh and don't forget to increase contrast first, and/or saturate the colors, so as to make the image look more artificial, like a model in a studio. That is a very important element of tilt-shift
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: MagickCompositeImage BlurCompositeOp UndefinedException
If I precede a BlurComposite with the MagickCore call:
then the MagickCompositeImage succeeds.
But if I precede it with the MagickWand call:
then this function returns MagickFalse and then the BlurComposite also fails.
Bug?
Pete
Code: Select all
SetImageArtifact(dest->images,"compose:args","15");
But if I precede it with the MagickWand call:
Code: Select all
MagickSetImageArtifact(dest,"compose:args","15")
Bug?
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See my message in this topic for a link to a zip of all the files.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: MagickCompositeImage BlurCompositeOp UndefinedException
Depends on what 'dest' is in MagickWand. I don't know as I don't use that interface normally. I know some MagickCore as I often program new functions in MagickCore. In fact I was the one to re-design the 'extra argument' passing for ImageComposite() so as to follow new standard way of passing such 'out of band' data.
You may like to read the updated sections in IM examples, Basics, on Attributes, Settings (Properities) and Defines (Atrifacts)... http://www.imagemagick.org/Usage/basics/#settings
More than likely the function is applied to the image and it the looks up the global "image_info" for that image list from the pointer in the image itself. The structures are highly interconnected. Only Cristy would know for sure without following the code itself.
You may like to read the updated sections in IM examples, Basics, on Attributes, Settings (Properities) and Defines (Atrifacts)... http://www.imagemagick.org/Usage/basics/#settings
More than likely the function is applied to the image and it the looks up the global "image_info" for that image list from the pointer in the image itself. The structures are highly interconnected. Only Cristy would know for sure without following the code itself.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: MagickCompositeImage BlurCompositeOp UndefinedException
Indeed it doesDepends on what 'dest' is in MagickWand
This works:
Code: Select all
MagickSetImageArtifact(src,"compose:args","15");
MagickCompositeImage(dest,src,BlurCompositeOp,0,0);
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See my message in this topic for a link to a zip of all the files.
-
- Posts: 2
- Joined: 2011-03-11T19:55:07-07:00
- Authentication code: 8675308
Re: MagickCompositeImage BlurCompositeOp UndefinedException
Thanks, that's what i was missing!
I got it to work before by just creating a blurred version, alpha-ing out some of it using the gradient, then using regular OverCompositeOp to combine blurred and original.
The BlurComposite version is much slower (1 second, vs ~25 seconds) and produces a motion blurred looking result
I got it to work before by just creating a blurred version, alpha-ing out some of it using the gradient, then using regular OverCompositeOp to combine blurred and original.
Code: Select all
// create blurred version
MagickWand * blurred = CloneMagickWand( aMagickWand );
status = MagickGaussianBlurImage(blurred, 4, 4);
checkImageMagick( status, blurred, true );
// Mask out part of the blurred version
status = MagickCompositeImage(blurred, aGradientWand, CopyOpacityCompositeOp, 0, 0);
checkImageMagick( status, blurred, true );
// copy blured over original
status = MagickCompositeImage(aMagickWand, b
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: MagickCompositeImage BlurCompositeOp UndefinedException
CompositeBlur is slow, because it is highly variable. It often has to redefine the filter for every pixel.
In previous versions of IM I only defined the filter once, and then adjusted the ellipse size, but that fails when ellipse sizes become too small for 'micro blurs'. It resulted in a sudden cutoff when the blur for a specific pixel went below 1 pixel.
I am looking for a better solution. But it has now become a much lower priority for me.
You are welcome to look at the code in "composite.c" (search for Blur).
In previous versions of IM I only defined the filter once, and then adjusted the ellipse size, but that fails when ellipse sizes become too small for 'micro blurs'. It resulted in a sudden cutoff when the blur for a specific pixel went below 1 pixel.
I am looking for a better solution. But it has now become a much lower priority for me.
You are welcome to look at the code in "composite.c" (search for Blur).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: MagickCompositeImage BlurCompositeOp UndefinedException
FYI: I've added Anthony's tilt_shift example (http://www.imagemagick.org/Usage/photos/#tilt_shift) to my Magickwand Examples (see my sig).
Pete
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See my message in this topic for a link to a zip of all the files.