Sorting of images based on their position on the page

How would I go about sorting the images based on their position on the page? I've read a few articles which mention the use of table method fate and checking their x and y values to sort the table. While that works on the page elements that are perfectly aligned with their x and is the axis, it fails on a layout like this. Does anyone have any ideas on how I could create an individual table for line1, line2, Row3 etc based on his position there and then sort them based on their position X and then create the master table combining them in order?

I'm new to javascript, so it's a bit out of my League. Any help will be much appreciated.

rows.jpg

Hi again,

I found an idea that seems promising to deal with the issues mentioned above. The main problem, as you have no doubt noticed, is that we cannot simply count about to coordinates (x, y) 'as they are', even after having rounded values, to extract implied rows and columns.

When we look at the layout below:

our eyes instantly detect what he expected to be 3 columns and 5 rows, but this underlying order is not immediately accessible from all sort all of the coordinates. We need to improve the algorithm.

What I propose is to speculate about the gaps that occur on the ordered sequence of coordinates x and y, respectively. To reveal these gaps, we will first sort the data along the x-axis:

The figure above shows that the width of the rectangles. Each arrow represents a rectangle, and I ordered the elements by increasing x-centers. We can estimate that the element identified #1 belongs to a new group of this simple fact: its left coordinate (red mark) is higher than the coordinated right (blue guide) of the #0element. This observation will give us a strategy to identify gaps in the column.

Then, the same method is applied to detect the lines. (Sort by values y, identify gaps, based on the progress of the min - max).

At the end of this process, each object has a (column, row) coordinate pair instead of fragmented values (x, y) . So, we can calculate the final order, i.e. the weight of the comparison function.

Here is my implementation of this algorithm:

// ========================================================
// Up2Bottom and Left2Right Sorting Algorithm
//   addressing (weakly) sparse rectangles
// ---
// Usage:  Select the objects, then run the script
// Target: InDesign CS4/CS5/CS6/CC
// ========================================================

const CS = +CoordinateSpaces.SPREAD_COORDINATES,
      AP_MIN = +AnchorPoint.TOP_LEFT_ANCHOR,
      AP_CENTER = +AnchorPoint.CENTER_ANCHOR,
      AP_MAX = +AnchorPoint.BOTTOM_RIGHT_ANCHOR;

var sel = app.properties.selection || null,
    data = [],
    r, i, j, k, t, n, w, vMax;

if( sel && 1 < (n=sel.length) )
    {
    // Collect coordinates and IDs
    // --> {min:[xLeft, yTop], weight:[x,y], max:[xRight,yBottom], id}[]
    for(i=0 ; i < n && (t=sel[i]) ; ++i )
        {
        data[i] = {
            min:    t.resolve(AP_MIN,CS)[0],
            weight: t.resolve(AP_CENTER,CS)[0],
            max:    t.resolve(AP_MAX,CS)[0],
            id:      t.id
            };
        }

    // Find rows and columns [i.e. y-weights and x-weights]
    // ---
    for( j=0 ; j < 2 ; ++j )
        {
        // Sort by center coordinate
        // ---
        data.sort(function(a,b){return a.weight[j] - b.weight[j]});

        // min > max ==> w++
        // ---
        for(vMax=(t=data[0]).max[j], t.weight[j]=(w=0), i=1 ; (i < n)&&(t=data[i]) ; ++i )
            {
            if( t.min[j] > vMax ){ ++w; vMax=t.max[j]; }
            t.weight[j] = w;
            }
        }

    // Compute final weights, clean up data, create ID-to-weight access
    // ---
    for( i=0 ; (i < n)&&(t=data[i]) ; ++i )
        {
        w = n*t.weight[1] + t.weight[0];  // final weight (y first)
        k = '_'+t.id;                     // ID key

        (t.min.length=0)||(t.weight.length=0)||(t.max.length=0);
        delete t.min; delete t.weight; delete t.max; delete t.id;
        delete data[i];

        data[k] = w;                      // ID-to-weight
        }

    // Apply sort --> r
    // ---
    r = sel.sort(function(a,b){return data['_'+a.id]-data['_'+b.id];});

    // Show the resulting order
    // ---
    for( i=0 ; i < n ; ++i )
        {
        app.select(r[i]);
        $.sleep(1000);
        }
    }

@+

Marc

Tags: InDesign

Similar Questions

  • return the objects while maintaining the position on the page

    Is there a a way to return multiple objects at the same time while maintaining their position on the page without having to select each individually? For example, if I had a box of text at the top and bottom of a page, choose both and then reversed them, rather than the top text box swapping with that down they times remain in the same place but flip backwards?

    In Illustrator, you'd have the transformation of each command to do this, but in InDesign, you must use the function transform once again, which, if you're just flipping 2 objects records all the steps. But, let's say you want to return 16 objects as you describe... in place.

    Select one and choose object > transform > Flip (Horizontal or Vertical)...

    Now select the other 15 and choose object > transform again > transform again individually

  • [JS] Moves the position of the Page in CS3/CS4? (like CS5 page.transform)

    When resizing a default document, InDesign uses a central point of reference. In CS5 and then I know that I can use page.transform to move the position of the page where I want (art does not, move the page under art). Is - there anyway do the equivalent in CS3 or CS4?

    To say it in other words, after you resize the width of the document, the art is not in the right place on the smallest width of page. Y at - it an easy way to position/move the page under art, or should I spend all the art page? If I have to move all the art, is there an easy way to do this considering that there may be several layers, objects/layers locked?

    I hope that makes sense. Thanks in advance,

    Dan

    N °

    You will need to loop through all the pageItems and move them individually (check if they are locked as you go...)

    Substances

  • graphics are moving from their position in the browser view

    I have a column of text with void heads and a few lines of text below each subtitle. I have small places graphic next to each subtitle. I want the graphics to match with the subtitle. When I discovered this browser, the rush of graphics mode and lose their positions. Especially if you enlarge the display in your browser (Safari > order > more) or reduce the view (command > less). The graphics are jumping above and below the text. Can I lock them in the respective positions?

    Ben

    Just got this resolved technical support. Phew! They sent me this link to the video of explanation and how to solve:

    http://www.screencast.com/t/ao3syjgXa

  • Serious accidents with control of the expression spacing based on z-position of the layer

    I have massive crashes when you use this script expression below. I have just a text layer where I control the depandend letter-spacing of the current z position. From z = 0 to-500 (directly in front of the camera), the values are transformed by easyOut() from 0-10. So far, that's all.

    Now when I duplicate this line of text several times and start to change its position, then the accident happens. Text layers more I have the sooner the crash. This occurs when the edition therefore not made involved. In the preview is the applied standard rendering engine.

    Unfortunately, there is no specific error message - it indicates just that AFX no longer works and is now closed.

    My system features:

    I have 8 GB of RAM and 10 GB disk cache. That should be enough for a text flying around.

    I use the latest Version of CC of AFX 2015.1 13.6.1.6 running on Windows Ultrabook (Lenovo Yoga 1) 8.1. No CUDA detected so the preview is rendered by the CPU.

    Anyone has an idea why this happens? Help is very appreciated.

    max_spacing = 10;
    z_position = transform.position[2];
    var new_spacing = easeOut(z_position, -500, 0, max_spacing, 0);
    text.animator("Animator 1").property.trackingAmount = new_spacing;
    

    This is my test scene:

    http://Augenpulver-design.de/Exchange/tmp/AFX_Expression_Crash_Scene.zip

    You create a hole of logic by referencing the layer itself probably. Should not happen, then I would call it a bug. Probably to do with flaky matrix code also used to smack and a few other things. Try to use a Null value and parent the text to it. This would work much better.

    Mylenium

  • When I set the "T" of the effects of scroll handle, my image moves out of position in the browser view?

    Capture 1.PNGCapture 2.PNG

    Initial position will define the relative position of content on the page load, so when the page scrolls point then scroll function on the content will be active.

    Thank you

    Sanjit

  • How can I use applescript to move objects to a specific position on the page?

    I have a PDF file with a bunch of items of text on each page, but the margins are irregular.  I want to automate the following process:

    1. Select all the objects on the page

    2. move objects (such as a group, i.e. preserving their arrangement relative to each other) until the upper left corner of the object of most of the top-left {. 67 ", 1"} from the upper left corner of the page.

    3. go to the next page.

    4. Repeat steps.

    I work on a mac, and I see that Acrobat is scriptable using Applescript.  Is it possible to do it with this?  If there is another way to describe this process without Applescript, I'd be open to that as well.

    Thank you very much.

    Acrobat has no interface for scripts change the position of an ordinary object.

  • Change the position of the pages

    I'm working on PC, with Indesign CS 3. I wrote a 600-page book, 400 photos and extensive notes. Now, I try to change the position of 10 pages. The order 'verschieben Seiten' is OK, no problem with - for example - the pagenumbers. BUT: My notes numbers will not be told. Example: I take Page X with note 30-34, page 250 page 420. The last note on this page is 320. Now, my notes on page X must be reported: NO 30-34, BUT 321-325. It does not work. My X page changes the place, but my notes do not recognized this. They believe that they are already to the 250 page... Is there a possibility to reorganize my notes? InDesign

    This has nothing to do with age! This is the expected behavior.

    Break the link between text blocks is unnecessarily complicated, for

    the reason why you've noticed. And Adobe has not provided a simple way to

    that, although there is at least a free script available

    somewhere out there.

    But a script is not required.

    Break the link as you did. The text disappears.

    Now, place your cursor in text after the last visible character in the

    previous text block. Press CtrlSHIFTend to select all the invisible

    text. Press Ctrl-X to cut it. Place your cursor in the empty text frame,

    and paste the text you have just cut.

    That's it: the link is now broken, and everything should be in place.

    Repeat for the last image (as in my previous post) and continue

    According to the above instructions.

  • Positioning of the page printing Options

    Hello

    InDesign has the print options for the placement of the Page under "print > Setup > Options > > Page Position.

    This allows to center the objects printed on the page. For example, to print an A4 paper on A3 paper and have a large area around the content for users to write on.

    Is there something similar in InCopy for printing the "layout view"? I looked but have been unable to find something useful.

    Thank you.
    print.png

    Hi David,

    Although the goal of InDesign is completely different from InCopy. You can still print out InCopy stories, please see the link below, but it has all of the options you mentioned as an identifier.

    Using InCopy | Print stories

    Kind regards

    OM

  • If necessary, scroll to the same position after the page navigation

    Hello

    I have a use case where I have an af:table and a full line. Now, when rolls the user down to a particular rank and click on to access the different page (DrillDown). Now when the user returns to the page, the scroll of the table position must be kept. As if I clicked on the 5th row in a range displays, it should be displayed as the 5th in the user interface.

    I use Jdev 11.1.1.7

    Please let me know if you need more details.

    Kind regards

    Chick.

    You can't possibly maintain accurate scrolling position (if I understand your question)

    As an alternative, you can modify your table to use paging: https://blogs.oracle.com/jdevotnharvest/entry/table_pagination_with_jdeveloper_11

    Dario

  • How the clip markers can be promoted in chronological markers?  I cut a clip and rearranged the order of the pieces in the timeline panel, so now I want a set of benchmarks that reflect their position in the timeline panel.

    Clip markers have as their frame of reference of the timeline, they came.  If you create a new brand of element in a new timeline, the marker in time is measured from his original script, not the new timeline where he is.  Currently in CC 2015 organization there is no way to translate the clip marker references 'Local' in the 'World calendar"in which they now live.  I captured on video a 8mm film that is chronologically jumble of short scenes.  I placed the chronology of chapter for each scene markers, export the list of markers and finally understood the rearrangement of pieces of scenes he needed to put everything in chronological order.  Thank God for the ability to export the list of markers, just as I needed!  So the whole sequence has 85 chronological markers, dividing the sequence into 5 pieces and rearranging puts them all in chronological order.  Obviously, I don't want to have to restore the scene boundries 85 times, I did as a necessary step to solve the puzzle.  I think you might meet one day some of these problems:

    1. the most obvious thing is located in the calendar for a piece, lift it and 'paste insert' where it belongs on the timeline.  Problem: Lift or excerpt from don't lift or extract chronological markers with it, so when "Insert you a block", the piece inserted in the timeline has lost its bearings, they were left.

    2. How about you make a sous-suite of the segment to move?  Yes, it carries all the tracks, but not the chronological markers whence he came.

    3. ok, I'll export the calendar together with chronological markers and reimport - ah, Yes, success, the chronology of the markers are now item, marks on the imported clip (the entire chronology).  That's great, because the clip markers are sticky with the clip, I can it chop, rearrange to put markers in chronological order without returning any info title marker.  Feeling beat with the reorganization completed five segments of the original timeline, everything is in order, nothing was reinstated, the timeline with its clip of chapter markers is ready to export to still make the DVD!  Yes, you guessed it, element chapter marks are not exported in yet.  The chronology of imports still with a marker, Chapter 1, at the beginning.

    4. There must be a way, stacked the timeline with the time markers on it on the icon for "New"... ', it is the same as #3 above, but simpler.  Historical markers are now the clip markers that don't export in yet.

    From my experiences, it is therefore impossible to solve my problem without completely restoring scene boundries and type chapter titles.  There are two repositories coordinated, clip) 1 local and 2) global chronology; and there is no way to go from one to the other 'mass'.   There is the glove, I'm sure someone has a way to do this without returning the title of chapter 85 markers.

    I have not found an automatic way to do this, but here is an efficient manual method that requires no titles of chapters Overtype.

    Either drop your timeline that has mounted the icon "Create New" brands, or export the timeline and import it back.  You now have a new timeline and markers are now on the video clip.  Now, chop and reorganize this video clip, it is in the best new order, and the clip markers stick with the sections of the clamp.  Now this procedure migrates the markers of the clips to the timeline (promotion):

    Start at the beginning of the timeline, select the video clip. (The video clip must be selected for M to open the marker editing window)

    1. type change M to find the first element brand, type M to open the editing window of clip marker, select the marker title and copy (control-C), hit Cancel

    2 hit the icon of reference in the program monitor pane, which puts a green marker on the timeline at the same time as the brand of element,

    3. double-click on the Green marker, paste the title of marker by control V, select the radio button of chapter markers, click OK.

    Repeat steps 1-3 to promote all the markers of clip of historical markers with the same marker titles.  Since we cut the timeline to reorganize, there are several video clips.  As you progress, make sure that the clip that you are working on is selected, otherwise M will not open the editing window, instead, it will place a chronological marker.  In short, follow this procedure exactly, it works.  It's a stupid job, but it does the job with without having to retype marker titles.  The chronology chapter titles now think time on the new timeline and they will export in yet.  Hope someone finds it useful at some point in the future.

    Perhaps team first see the usefulness of this and add a command 'Promote the clip for mounting marks markers' and "retrograde chronological markers for the clip markers" (conservation type, title and comments).  It would be a powerful addition.

  • M712 repetitive image problem. Can not find the page for service with the official RULE

    I have to review the manuals online here and I googled for them as well.

    Nobody seems to have an official repetitive image for the M712 default rule page.

    My impressions can repeat the points that occur each 1.75 "or 44 mm.

    Looking at an older manual for a different model of printer, a HP 5100, this repetitive error indicates a Toner Cartridge primary charging roller.

    Since most of these parts are internal to the toner cartridge, I've already replaced a new cartridge of HP brand. No help.

    Most replaced suspect parts with a kit of maint merger, no help.

    I can assume either us:

    -a got a refurb had somehow HP ink cartridge or

    -a got another somehow cartidge PROBLEM or

    -the charge roller is NOT located within this model of printer toner cartridge and my roll charge elsewhere in the printer

    Someone at - it all pages of repetitive image rule for this prnter model?

    Thanks in advance.

    Test for half. Place a sheet of paper in the manual feeder on the right side and perform a self-test. When the rear edge of the paper into the printer, quickly open the toner door to stop printing. Remove the toner cartridge and look at the picture without fuse below. If the fault is present, it is still the toner and nothing else. If the defect is not present, then the question is fuser. Run a menu card and see if she has a routine cleanup of page and if it does not work there. If this is not the case, the fuser unit will probably be replaced.

  • Browser blackBerry Smartphones goes back to the top of the page rather than in the position on the page

    When to return to the previous page, the web browser of the Torch 9800 always goes to the top of the previous page instead of the previous position, so he must always scroll down to the old post to continue playback from the previous post. Any solution to this?

    Problem solved with the latest version of the device software 6.0.0.246

  • Orcle ADF: Background Image of panel group put on the page is not getting displayed in stubborn browser task-flow

    Hello I'm developing a web application using ADF (jdeveloper 11.1.2.4). I have a template that I have panelGroupLayout. I put a background image for the grouplayout. And I created a test.jsf page from this template. When I run this page directly background image is displayed in the browser. I put this page in a stubborn taskflow. My problem is when I execute this page of the stubborn taskflow background image is not displayed.

    Image is displayed for this URL: http://127.0.0.1:7101/EasyRUN-ViewController-context-root/faces/login?_adf.ctrl-state=1px1s1o6o_26

    Image is not posting to this URL: :7101/EasyRUN-ViewController-context-root/faces/admin-flow-definition/homePage?_adf.ctrl-state=1px1s1o6o_29 http://127.0.0.1

    Please help me. Thanks in advance.

    The part of the url of the background image is the problem, probably

    As first of all, try to assign relative to your location of workflow, for example:

    background-image: url("..) ("/ ERUnBPart2.png")

    just to see what happens

  • positioning of the page layout

    Here is my problem child. http://www.indianaeagleforum.org/contact_join.html
    How can I get my also, centered layout like in http://www.indianaeagleforum.org/index.html how to make the image and the text stay in the width to 780 pixels as in the index page. Thank you very much.
    Diana Hunter

    I think I got it after several tries. See http://www.indianaeagleforum.org/contact_join.html

Maybe you are looking for