How to arrange images of different sizes into a Grid
Hi,
I have a set of about 1000 photos which i have to arrange into Deep Zoom. They are of various sizes.
In the deep zoom composer i can arrange them in a proper order.
But when i want to shuffle the images or to sort by tag, the images not being of the same size, are not aligned properly.
I had earlier tried for images of same sizes and arranged them into a grid format using the following code
private void ArrangeIntoGrid(List<MultiScaleSubImage> imagesList)
{
int totalImagesAdded = 0;
int imagesCount = imagesList.Count;if (imagesCount > 1)
{
columns = 0;
columns = (int)Math.Ceiling(Math.Sqrt(imagesCount));
rows = imagesCount / (columns - 1);
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
if (imagesCount != totalImagesAdded)
{
MultiScaleSubImage currentImage = imagesList[totalImagesAdded];Point currentPosition = currentImage.ViewportOrigin;
Point futurePosition = new Point(-1.02 * j, -0.77 * i);//Creating the Animation
Storyboard moveStoryboard = new Storyboard();PointAnimationUsingKeyFrames moveAnimation = new PointAnimationUsingKeyFrames();
SplinePointKeyFrame startKeyframe = new SplinePointKeyFrame();
startKeyframe.Value = currentPosition;
startKeyframe.KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);startKeyframe = new SplinePointKeyFrame();
startKeyframe.Value = futurePosition;
startKeyframe.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1));KeySpline ks = new KeySpline();
ks.ControlPoint1 = new Point(0, 1);
ks.ControlPoint2 = new Point(1, 1);
startKeyframe.KeySpline = ks;
moveAnimation.KeyFrames.Add(startKeyframe);Storyboard.SetTarget(moveAnimation, currentImage);
Storyboard.SetTargetProperty(moveAnimation, new PropertyPath("ViewportOrigin"));moveStoryboard.Children.Add(moveAnimation);
moveStoryboard.Begin();
totalImagesAdded++;
}
else
{
break;
}
}
}
}
else
{
MultiScaleSubImage currentImage = imagesList[0];
currentImage.ViewportOrigin = new Point(0, 0);
}
}
This is fine for images of same size, but i am stuck arranging images of different shapes.
Can anyone help?
Thanks in advance,
-Deepika
All Replies
Re-Post.
Can anyone help me out with this.
-Deepika- Hi Deepika,
I can look into this next week if nobody else has responded to you by then.
Cheers!
Kirupa :) - Thanks Kirupa, Will be waiting for your reply.
Thanks,
Deepika. - Sorry for the reposts.
I have tried out many ways to resolve this, i am not getting a clean output.
Can anyone of you Pleaseee help me out with this.
Thanks in advance,
Deepika - Can anyone pleease help me out with this.
I am not able to achieve at a perfect solution.
-Deepika - Deepika,
Did you get any solution for this? If yes, Could you let me know? I am kind of encountered with the same kind of issue...
- Chai - Hi Chaithanya,
I haven't got any perfect solution for this.
I have set all the hrights of the images to be equal and adjusted the Viewport origin to resolve my issue.
But that isn't a standard solution, but i havent got enough time to work on that.
-Deepika

