Expression > Forums Home > Related Technologies Forums > Deep Zoom Composer > How to arrange images of different sizes into a Grid
Ask a questionAsk a question
 

QuestionHow to arrange images of different sizes into a Grid

  • Thursday, June 18, 2009 9:38 AMPeriDeepika Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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

  • Friday, July 17, 2009 5:26 AMPeriDeepika Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Re-Post.
    Can anyone help me out with this.

    -Deepika

  • Sunday, July 19, 2009 4:44 AMkirupaModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Deepika,
    I can look into this next week if nobody else has responded to you by then.

    Cheers!
    Kirupa :)
  • Monday, July 20, 2009 3:22 AMPeriDeepika Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Kirupa, Will be waiting for your reply.

    Thanks,
    Deepika.
  • Wednesday, July 29, 2009 8:43 AMPeriDeepika Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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
  • Monday, August 03, 2009 11:22 AMPeriDeepika Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Can anyone pleease help me out with this.
    I am not able to achieve at a perfect solution.

    -Deepika
  • Thursday, October 15, 2009 12:13 PMChaithanya Krishnan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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
  • Wednesday, October 21, 2009 3:47 AMPeriDeepika Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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