Hi,
I am trying to produce what looks like a heap of photos. I found this as a starting point:
http://rubblewebs.co.uk/imagemagick/display_example.php?example=49 - a php example -
but I want to drive it from a code loop, using random position and rotate.
My code is below:
1) When I angle the pictures with rotate I get a white bounding box that I do not want
2) I set the border and border color - the border is there (light grey), but I expect it to be red here
3) I would like to make most of the pictures nearly transparent, so the top few stand out - these will eventually be positioned carefully so as not to overlap. I can't find a way to do this.
4) I also notice image degradation - does that come from running Composite in a loop, and is there a better way to do it all at once? I found an example here http://www.imagemagick.org/Usage/layers/#layer_prog that uses MIFF:- - can that be done here and would it help?
Thanks for Magick.NET and for any help.
I am trying to produce what looks like a heap of photos. I found this as a starting point:
http://rubblewebs.co.uk/imagemagick/display_example.php?example=49 - a php example -
but I want to drive it from a code loop, using random position and rotate.
My code is below:
using (MagickImage image = new MagickImage(new MagickColor("blue"), 3000, 3000))
{
var rand = new Random();
var rand2 = new Random();
var files = Directory.GetFiles("g:\\picsin", "*.jpg");
for (int i = 1; i < 5; i++)
{
string infile = files[rand.Next(files.Length)];
using (MagickImage image2 = new MagickImage(infile))
{
image2.Settings.BorderColor = new MagickColor("red");
image2.Border(30);
image2.Rotate(rand2.Next(-25, 25));
image2.BackgroundColor = new MagickColor("transparent"); //doesn't help
image.Composite(image2, rand2.Next(100, 2500), rand2.Next(100, 2500));
}
}
image.Write(outfile);
}
The result is at http://i.imgur.com/FfJvgO5.gif1) When I angle the pictures with rotate I get a white bounding box that I do not want
2) I set the border and border color - the border is there (light grey), but I expect it to be red here
3) I would like to make most of the pictures nearly transparent, so the top few stand out - these will eventually be positioned carefully so as not to overlap. I can't find a way to do this.
4) I also notice image degradation - does that come from running Composite in a loop, and is there a better way to do it all at once? I found an example here http://www.imagemagick.org/Usage/layers/#layer_prog that uses MIFF:- - can that be done here and would it help?
Thanks for Magick.NET and for any help.