How to arrange images of different sizes into a Grid<p>Hi,<br/><br/>I have a set of about 1000 photos which i have to arrange into Deep Zoom. They are of various sizes.<br/>In the deep zoom composer i can arrange them in a proper order.<br/>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.<br/>I had earlier tried for images of same sizes and arranged them into a grid format using the following code<br/><br/><br/>        private void ArrangeIntoGrid(List&lt;MultiScaleSubImage&gt; imagesList)<br/>        {<br/>            int totalImagesAdded = 0;<br/>            int imagesCount = imagesList.Count;</p> <p>            if (imagesCount &gt; 1)<br/>            {<br/>                columns = 0;<br/>                columns = (int)Math.Ceiling(Math.Sqrt(imagesCount));<br/>                rows = imagesCount / (columns - 1);<br/>                for (int i = 0; i &lt; rows; i++)<br/>                {<br/>                    for (int j = 0; j &lt; columns; j++)<br/>                    {<br/>                        if (imagesCount != totalImagesAdded)<br/>                        {<br/>                            MultiScaleSubImage currentImage = imagesList[totalImagesAdded];</p> <p>                            Point currentPosition = currentImage.ViewportOrigin;<br/>                            Point futurePosition = new Point(-1.02 * j, -0.77 * i);</p> <p>                            //Creating the Animation<br/>                            Storyboard moveStoryboard = new Storyboard();</p> <p>                            PointAnimationUsingKeyFrames moveAnimation = new PointAnimationUsingKeyFrames();</p> <p>                            SplinePointKeyFrame startKeyframe = new SplinePointKeyFrame();<br/>                            startKeyframe.Value = currentPosition;<br/>                            startKeyframe.KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);</p> <p>                            startKeyframe = new SplinePointKeyFrame();<br/>                            startKeyframe.Value = futurePosition;<br/>                            startKeyframe.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1));</p> <p>                            KeySpline ks = new KeySpline();<br/>                            ks.ControlPoint1 = new Point(0, 1);<br/>                            ks.ControlPoint2 = new Point(1, 1);<br/>                            startKeyframe.KeySpline = ks;<br/>                            moveAnimation.KeyFrames.Add(startKeyframe);</p> <p>                            Storyboard.SetTarget(moveAnimation, currentImage);<br/>                            Storyboard.SetTargetProperty(moveAnimation, new PropertyPath(&quot;ViewportOrigin&quot;));</p> <p>                            moveStoryboard.Children.Add(moveAnimation);</p> <p>                            moveStoryboard.Begin();</p> <p>                            totalImagesAdded++;<br/>                        }<br/>                        else<br/>                        {<br/>                            break;<br/>                        }<br/>                    }<br/>                }<br/>            }<br/>            else<br/>            {<br/>                MultiScaleSubImage currentImage = imagesList[0];<br/>                currentImage.ViewportOrigin = new Point(0, 0);<br/>            }<br/>        }<br/><br/>This is fine for images of same size, but i am stuck arranging images of different shapes.<br/>Can anyone help?<br/><br/>Thanks in advance,<br/><br/>-Deepika<br/><span style="font-size:x-small"> <p> </p> </span></p>© 2009 Microsoft Corporation. All rights reserved.Wed, 21 Oct 2009 03:47:13 Z26d84c0d-2fe6-463c-9e71-cbe5fffdbd09http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#26d84c0d-2fe6-463c-9e71-cbe5fffdbd09http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#26d84c0d-2fe6-463c-9e71-cbe5fffdbd09PeriDeepikahttp://social.expression.microsoft.com/Profile/en-US/?user=PeriDeepikaHow to arrange images of different sizes into a Grid<p>Hi,<br/><br/>I have a set of about 1000 photos which i have to arrange into Deep Zoom. They are of various sizes.<br/>In the deep zoom composer i can arrange them in a proper order.<br/>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.<br/>I had earlier tried for images of same sizes and arranged them into a grid format using the following code<br/><br/><br/>        private void ArrangeIntoGrid(List&lt;MultiScaleSubImage&gt; imagesList)<br/>        {<br/>            int totalImagesAdded = 0;<br/>            int imagesCount = imagesList.Count;</p> <p>            if (imagesCount &gt; 1)<br/>            {<br/>                columns = 0;<br/>                columns = (int)Math.Ceiling(Math.Sqrt(imagesCount));<br/>                rows = imagesCount / (columns - 1);<br/>                for (int i = 0; i &lt; rows; i++)<br/>                {<br/>                    for (int j = 0; j &lt; columns; j++)<br/>                    {<br/>                        if (imagesCount != totalImagesAdded)<br/>                        {<br/>                            MultiScaleSubImage currentImage = imagesList[totalImagesAdded];</p> <p>                            Point currentPosition = currentImage.ViewportOrigin;<br/>                            Point futurePosition = new Point(-1.02 * j, -0.77 * i);</p> <p>                            //Creating the Animation<br/>                            Storyboard moveStoryboard = new Storyboard();</p> <p>                            PointAnimationUsingKeyFrames moveAnimation = new PointAnimationUsingKeyFrames();</p> <p>                            SplinePointKeyFrame startKeyframe = new SplinePointKeyFrame();<br/>                            startKeyframe.Value = currentPosition;<br/>                            startKeyframe.KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);</p> <p>                            startKeyframe = new SplinePointKeyFrame();<br/>                            startKeyframe.Value = futurePosition;<br/>                            startKeyframe.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1));</p> <p>                            KeySpline ks = new KeySpline();<br/>                            ks.ControlPoint1 = new Point(0, 1);<br/>                            ks.ControlPoint2 = new Point(1, 1);<br/>                            startKeyframe.KeySpline = ks;<br/>                            moveAnimation.KeyFrames.Add(startKeyframe);</p> <p>                            Storyboard.SetTarget(moveAnimation, currentImage);<br/>                            Storyboard.SetTargetProperty(moveAnimation, new PropertyPath(&quot;ViewportOrigin&quot;));</p> <p>                            moveStoryboard.Children.Add(moveAnimation);</p> <p>                            moveStoryboard.Begin();</p> <p>                            totalImagesAdded++;<br/>                        }<br/>                        else<br/>                        {<br/>                            break;<br/>                        }<br/>                    }<br/>                }<br/>            }<br/>            else<br/>            {<br/>                MultiScaleSubImage currentImage = imagesList[0];<br/>                currentImage.ViewportOrigin = new Point(0, 0);<br/>            }<br/>        }<br/><br/>This is fine for images of same size, but i am stuck arranging images of different shapes.<br/>Can anyone help?<br/><br/>Thanks in advance,<br/><br/>-Deepika<br/><span style="font-size:x-small"> <p> </p> </span></p>Thu, 18 Jun 2009 09:38:19 Z2009-06-18T09:38:19Zhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#adeeaed2-bdf1-4bf4-a9fa-950a6aedb336http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#adeeaed2-bdf1-4bf4-a9fa-950a6aedb336PeriDeepikahttp://social.expression.microsoft.com/Profile/en-US/?user=PeriDeepikaHow to arrange images of different sizes into a Grid<p>Re-Post.<br/>Can anyone help me out with this.<br/><br/>-Deepika</p>Fri, 17 Jul 2009 05:26:28 Z2009-07-17T05:26:28Zhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#c12a8957-17dd-4878-81ff-d32268bc3447http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#c12a8957-17dd-4878-81ff-d32268bc3447kirupahttp://social.expression.microsoft.com/Profile/en-US/?user=kirupaHow to arrange images of different sizes into a GridHi Deepika,<br/>I can look into this next week if nobody else has responded to you by then.<br/><br/>Cheers!<br/>Kirupa :)Sun, 19 Jul 2009 04:44:52 Z2009-07-19T04:44:52Zhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#d493991d-14a8-4736-9607-d8f11fac6e1dhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#d493991d-14a8-4736-9607-d8f11fac6e1dPeriDeepikahttp://social.expression.microsoft.com/Profile/en-US/?user=PeriDeepikaHow to arrange images of different sizes into a GridThanks Kirupa, Will be waiting for your reply.<br/><br/>Thanks,<br/>Deepika.Mon, 20 Jul 2009 03:22:36 Z2009-07-20T03:22:36Zhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#3b69ff9a-c4f5-4fa8-9830-d14abb86431dhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#3b69ff9a-c4f5-4fa8-9830-d14abb86431dPeriDeepikahttp://social.expression.microsoft.com/Profile/en-US/?user=PeriDeepikaHow to arrange images of different sizes into a GridSorry for the reposts.<br/>I have tried out many ways to resolve this, i am not getting a clean output.<br/>Can anyone of you Pleaseee help me out with this.<br/><br/>Thanks in advance,<br/>DeepikaWed, 29 Jul 2009 08:43:03 Z2009-07-29T08:43:03Zhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#3eceba21-255c-4de3-9f5e-fcb1a2473116http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#3eceba21-255c-4de3-9f5e-fcb1a2473116PeriDeepikahttp://social.expression.microsoft.com/Profile/en-US/?user=PeriDeepikaHow to arrange images of different sizes into a GridCan anyone pleease help me out with this.<br/>I am not able to achieve at a perfect solution.<br/><br/>-DeepikaMon, 03 Aug 2009 11:22:44 Z2009-08-03T11:22:44Zhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#7c5bd864-2621-4cbc-96f0-1d88d0b702d7http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#7c5bd864-2621-4cbc-96f0-1d88d0b702d7Chaithanya Krishnanhttp://social.expression.microsoft.com/Profile/en-US/?user=Chaithanya%20KrishnanHow to arrange images of different sizes into a GridDeepika,<br /><br />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...<br /><br />- ChaiThu, 15 Oct 2009 12:13:13 Z2009-10-15T12:13:13Zhttp://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#5f9fd097-79a9-46d2-b8c8-5641d320f614http://social.expression.microsoft.com/Forums/en-US/deepzoomcomposer/thread/26d84c0d-2fe6-463c-9e71-cbe5fffdbd09#5f9fd097-79a9-46d2-b8c8-5641d320f614PeriDeepikahttp://social.expression.microsoft.com/Profile/en-US/?user=PeriDeepikaHow to arrange images of different sizes into a GridHi Chaithanya,<br/><br/>I haven't got any perfect solution for this.<br/>I have set all the hrights of the images to be equal and adjusted the Viewport origin to resolve my issue.<br/>But that isn't a standard solution, but i havent got enough time to work on that.<br/><br/>-DeepikaWed, 21 Oct 2009 03:47:13 Z2009-10-21T03:47:13Z