JS CS3 flag duplicate images with scale and rotation differnce

I've been trying to cut down on the number of images a script I have would produce.  The old script would look for links that are being used multiple times and then just version the link which is fine.  What I am finding this that although a document may have one image linked 9 time 6 times out of the nine the image is scaled and rotated the same amount and the other 3 times the rotation and scaling also match. In this example the image only needs 2 versions the first as the original and the second with the scale and rotation of the image used 3 time let say.
So to the code:
The following code will work through the doc and create an array of the links as duplicates:
function LinkUsage(myLink) {
    var myLinkCounter = 0;
        for (var myCounter =  0; myCounter < myDoc.links.length; myCounter++) {
        if (myLink.filePath == myDoc.links[myCounter].filePath) {
            myLinkCounter++;
    return myLinkCounter
var myDoc = app.activeDocument;var myNumLinks = [];
for ( var t = myDoc.links.length-1; t >= 0; t-- ){
    if(LinkUsage(myDoc.links[t])>1){
            myNumLinks.push(myDoc.links[t].id);
Is there a way to loop through the array and only flag the differnent scale and roatations.  What I should get is that out of the multiple link uasage the image is only changed twice out of the 9 times used.
I was trying to loop through the array and then loop through it within the loop to compare the link but this does not work for obvious reasons.
for (var i=0  ; i <myNumLinks.length; i++){
    var valLink = myDoc.links.itemByID( myNumLinks[i]);
        if(valLink.parent.constructor.name == "Image"){
            for (var j=0  ; j<myNumLinks.length; j++){
                if(myDoc.links.itemByID( myNumLinks[j]).parent.constructor.name == "Image"){
                    if(valLink.parent.parent.images[0].rotationAngle != myDoc.links.itemByID( myNumLinks[j]).parent.parent.images[0].rotationAngle){
                        $.write(myNumLinks[i]+"\n");
Is what I am trying to do possible and if so any suggestions would be appreciated.
Cheers, John.

I think I might be one step closer to getting this to work.  I've been able to just capture the file path of the duplicates using:
//count the number of times the link is used
function LinkUsage(myLink) {
    var myLinkCounter = 0;
        for (var myCounter =  0; myCounter < myDoc.links.length; myCounter++) {
        if (myLink.filePath == myDoc.links[myCounter].filePath) {
            myLinkCounter++;
    return myLinkCounter
//check if the filepath has been added to the array
function chkVal(val){
    var compCount = 0;
    for(var arr =  0; arr < myNumLinks.length; arr++){
        if(val == myNumLinks[arr] ){
        compCount++;
    if(compCount >=1){
        return false;
        }else{
            return true;
//check the links inthe doc
var myDoc = app.activeDocument;
var myNumLinks = [];
for ( var t = myDoc.links.length-1; t >= 0; t-- ){
    if(LinkUsage(myDoc.links[t])>1){
        if(myNumLinks == 0){
            myNumLinks.push(myDoc.links[t].filePath);
            }else{
                if(chkVal(myDoc.links[t].filePath)){
                    myNumLinks.push(myDoc.links[t].filePath);
for (var i=0  ; i <myNumLinks.length; i++){
    $.write(myNumLinks[i]+"\n");

Similar Messages

  • Itunes show duplicate, 1 with icloud and 1 without. are they both on hard drive?

    itunes shows duplicates - 2 with icloud and 1 without.
    are they both on hard drive?
    which ones should i delete?

    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    The should then show in your iTunes library. They are not anywhere else.

  • I deleted duplicate files with MacKeeper and now my firefox only shows text. I have reinstalled firefox, java, and checked all of my settings. Any ideas? Safari works fine.

    I deleted duplicate files with MacKeeper and now my firefox only shows text. I have reinstalled firefox, java, and checked all of my settings. Any ideas? Safari works fine.

    I opened iCal back up, all the dates were blank, so i started to type events into a date.
    As soon as I started to double click a date to type an event, magically all the events in all the months reappeared.
    I'm still puzzled why it acted this way and if I did delete something that caused it to act this way.

  • Scale and rotate a tiff image

    How do you scale and rotate a tiff image without running out of memory?
    I have been trying to scale the image and rotate it before i pass it to the DisplayJAI but i keep running out of memory.
    code i use to rotate the image.
    private Image rotateImage(boolean rotateRight)
    Image img = imageHolder.getInUseImageIcon().getImage();
    Image rot = null;
    int imageWidth = imageHolder.getInUseImageIcon().getIconWidth();
    int imageHeight = imageHolder.getInUseImageIcon().getIconHeight();
    int buffer[] = new int[imageWidth * imageHeight];
    int rotate[] = new int[imageWidth * imageHeight];
    try
    MediaTracker tracker = new MediaTracker (this);
    tracker.addImage (img, 0);
    tracker.waitForAll();
    PixelGrabber grabber = new PixelGrabber(img, 0, 0, imageWidth, imageHeight, buffer, 0, imageWidth);
    try {
    grabber.grabPixels();
    catch(InterruptedException e) {
    e.printStackTrace();
    if(rotateRight)
    for(int x = 0; x < imageWidth; x++)
    for(int y = 0; y < imageHeight; y++)
    rotate[(x*imageHeight)+y] = buffer[((imageHeight-y-1)*imageWidth)+x];
    else
    for(int y = 0; y < imageHeight; y++)
    for(int x = 0; x < imageWidth; x++)
    buffer[(y*imageWidth)+x] = rotate[((imageWidth-x-1)*imageHeight)+y];
    for(int y = 0; y < imageHeight; y++)
    for(int x = 0; x < imageWidth; x++)
    rotate[((imageWidth-x-1)*imageHeight)+y] = buffer[(y*imageWidth)+x];
    rot = createImage(new MemoryImageSource(imageHeight, imageWidth, rotate, 0, imageHeight));
    catch (Exception e)
    e.printStackTrace();
    return rot;
    this is the code i use to scaled the image.
    Image scaled = originalImage.getImage().getScaledInstance(
    (int)(currentWidth * 1.5),
    (int)(currentHeight * 1.5),
    Image.SCALE_FAST);
    I tried this method, it works and does what i want but the scrolling and loading is too slow.
    public void paintComponent(Graphics g)
    Graphics2D g2D = (Graphics2D)g;
    g2D.rotate(Math.PI/2, (int)dimension.getWidth()/2, (int)dimension.getHeight()/2);
    g2D.drawImage(image, 0,0,(int)dimension.getWidth(), (int)dimension.getHeight(), this);
    Help plss.

    Nvm got the answer :)

  • IBooks Author Scale and Rotate in preview

    I just started with iBooks Author. I made a simple book with several chapters and pages. When previewing the book in the iPad the pages zoom and rotate with a two finger gesture. Then snap bak to the default scale and rotation. Imagine trying to pinch to zoom, but having the page scale.
    How can make the pages use the standard zooming behavior with out rotating and hold the zoom without snapping back to the initial scle?

    Sorry about that. I haven't used that software before, but they appeared to fit the bill according to their descriptions.
    There is another program, Image Tricks, that is for Tiger and it will let you rotate images and save the changes.
    http://www.belightsoft.com/products/imagetricks/overview.php
    I can't find any hacks for Preview that will let you do what you want.
    PowerMac G5   Mac OS X (10.4.6)   1GB RAM, nvidia 6800 ultra, Apple 30" Cinema Display

  • Curious issue with extrude and rotate

    I've found a curious issue with extrude and rotate in CS6. It's not a bug, but it is a nonintuitive behavior that is confusing, and sometime troublesome. I think this is something that ought to go on the to-do list for the devs. Anybody else agree? Disagree?
    Example:
    I began with an arrow-shaped path, to which I applied the "extrude" effect. I then put an icon on top of the arrow, and grouped the icon and arrow. Now, I'm using this icon-arrow in several different parts of my design, in different orientations. As I rotate the arrow, the relative position of the icon and the arrow appears to shift. I believe this is happening because, as you rotate the icon-arrow, Illustrator rotates both the icon and the arrow about the center of the bottom face of the arrow. This is because the top face of the arrow is essentially fictitious, just an artifact of the extrude effect. So, even though the icon appears as if it is drawn on the top face of the arrow, it behaves as if it is attached to the bottom face of the arrow. When you apply a transform, that transform affects the bottom face of the arrow, causing the top face to shift relative to the icon.
    The solution would be to add an extra check box to the extrude effect, asking whether you wanted to extrude upwards (the way things are currently done) or downwards. If you could extrude downwards, then the top face of the arrow would be the "real" face, the one affected by transformations. You could then put an image on the top face, group the arrow and the image, and when you applied a transform, the icon would remain fixed relative to the top face, which would meet your intuitive expectations.
    If anyone is curious to experiment with this particular example, I've posted this file to Google docs here:
    https://docs.google.com/file/d/0B0Hoxcl5zTEtTXo5QnNsMGwwOGc/edit?usp=sharing

    but it does work because i downloaded your file and i did jsut that. it isn't exact, but your suggestion on how to fix it wouldn't fix it anyway. the reason the acorn doesn't match is because of the distortion from the perspective not the direction of the extrusion. even if you could dictate the extrusion to go downward, the arrow would still rotate into perspective (distort) and then extrude. to avoid that, what you want is to extrude in axonometric and to do that you make your perspective rotation angle 1 degree, then make your extrusion length a lot longer to match what you want. with 1 degree there will be minimal distortion to the arrow as you rotate it and the acron will match.
    i uploaded your file with your orignal 10 degree angle, and you'll see that they stay in sync pretty well. i drew a box around the acorn to better distinguish the difference. then i recreated the same thing with a 1 degree angle and on that version it stays in sync almost perfectly.
    again. it doesn't matter wich direction you extrude since in perspective both faces will be distorted. if you want to keep the distortion from the perspective, you can apply the same perspective rotation to the acorn without the extrusion and it will distort in the same way as the arrow. i added that option to your file. they are all group and you can rotate them and see that they stay together pretty well, except the first one is a little off.
    i uploaded your file with my solution
    https://docs.google.com/file/d/0B4ilRoSBagc3WDY3MUR1bDNpV0E/edit

  • Flash crashing when using Command + Option + S for Scale and Rotate?

    Flash crashing when using Command + Option + S for Scale and Rotate?
    It's happening to me when I use those hotkeys
    Please let me know if it's happening to you too.
    I don't know the cause but I need a fix.
    I'm using Adobe FLASH cs6 for Mac
    My computer:
    Mac mini
    Mid 2011
    Software  OS X 10.8.1 (12B19)
    -Line

    With all due respect to your totally coindescending reply, this is a bug in Flash. Happens every 4-5 times I use that menu item. Been happening for months, but  we just installed a Brand new iMac (1/13). Quadcore 3.4 16G RAM and 1TB Fusion drive. Fresh install of CS6. Not running any other 3rd Party Software. Problem STILL happens in new Flash docs with small, simple vector Graphics.
    So instead of blaming the users computers, how about you guys just fix the effin' problem? Thanks.

  • How to remove duplicate photos with Elements and Revel?

    While on vacation this year, I uploaded pictures from my camera to my iPad to Revel.  When I got home, I copied all of the pictures from my camera to my harddrive on my laptop and imported them into Elements 12.  On my laptop I store photos in subdirectories like this:  \Lisa\albums\Pictures201509.  I found duplicates of most of my photos in \Users\Owner\My Pictures\Adobe\Revel\My Catalog Old.  I would like to clean these up so I only have once copy of each photo on my harddrive.
    I have 3 questions:
    Why did this happen?
    How can I clean this up and not complete mess up my Elements and Revel catalogs?
    How can I prevent this in the future?
    thanks,
    Lisa

    The folks at www.overmacs.com/photosweeper told me that they are upgrading their product so it will work with Apple Photos.  It works now with iPhoto and Aperture.  It has many adjustments to detect same name files, and even same or similar content images.  Monitor their website for a future release.  There is a small fee for the pro version, which is well worth the price.

  • I just downloaded a movie and when I try to watch it, I just get an image with white and gray squares. ????  Sound is ok

    Hello:    I just downloaded a movie but I cannot any video when trying to watch it.  I just get n image of white and grey squares.   Sound is ok  ???

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • Images with width and height

    There is a way to insert an image inside of the html code
    with width and height already? I mean, now, if I want to insert an
    image at the code, goes only <img src="images/test.gif" /> I
    d like that if I insert an image it goes as: <img
    src="images/canto_topo.gif" width="8" height="29" />
    is possible in dreamwaver to do that?
    Thanks!
    Vismona

    If you insert the image using the "Insert Image" function, DW
    will
    automatically insert the width and height.
    Or, if you'd rather insert them the way you are, in the
    Property Inspector
    on the far left, click the dimensions next to the Image
    field, and DW will
    automatically add (or correct) the width and height.
    Hope that helps,
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet
    "Vismona" <[email protected]> wrote in
    message
    news:gc60ut$nmv$[email protected]..
    > There is a way to insert an image inside of the html
    code with width and
    > height
    > already? I mean, now, if I want to insert an image at
    the code, goes only
    > <img
    > src="images/test.gif" /> I d like that if I insert an
    image it goes as:
    > <img
    > src="images/canto_topo.gif" width="8" height="29" />
    >
    > is possible in dreamwaver to do that?
    >
    > Thanks!
    > Vismona
    >

  • Problem processing RAW images with Lion and 3.1.3

    Images that have "This photo was adjusted using an earlier version of Apple's RAW processing.  Attempting to send to a plug-in or Photoshop results in a dialog "Editing Error This image cannot be rendered for editing because Aperture does not support the image format."  Images that were previously processed with the current version of RAW processing work correctly.

    There is another discussion for problem with raw and the new 10.7.3.1 : my Raw from Panasonic GH2 are green and Aperture says : treatment with old version
    I find the solution to correct my RAW : they are green because of the bad WB applied by Aperture.
    I put here the solution but I have to correct manually and ask to treatment in the RAW windows for each picture. If it doesn't work, I correct manually the WB.
    https://discussions.apple.com/thread/3942768?start=0&tstart=0
    We have to report this bug to Apple.

  • DHTML List (Image) with Sublist and authorization problems

    Dear all -
    I wonder if anyone can help with this DHTML drop-down menu query:
    We use hierarchical menus implemented as DHTML Lists (Image) with Sublists. When some of the items are hidden through authorization, the wrong headers appear for the menus.
    For example:
    Menu
      Item 1
        Subitem 1 of Item 1
        Subitem 2 of Item 1
      Item 2
        Subitem 1 of Item 2
        Subitem 2 of Item 2
    Say Item 1 and its subitems are all hidden through authorization controls. The heading for Item 2 then appears as 'Subitem 2 of Item 1' instead of 'Menu'.
    There's an example here:
    http://htmldb.oracle.com/pls/otn/f?p=11837:1
    Anyone know why this is happening?
    Thanks for your time.
    John.
    PS. Any idea where my previous post on this subject has disappeared to?

    Carl - in the example on htmldb.oracle.com, in Menu2 I'm hiding all the elements in Category 1 (parent and children), although not the 'grandparent' (Menu2).
    I'm therefore still expecting the menu title to be 'Menu2', because that's Category 2's parent.
    It doesn't appear to be an issue with the sequence of the items, because I've changed all those about and still got the same problem.
    To be more specific, again using the htmldb.oracle.com example, in Menu2 we have:
    Menu2
      Category 1 (Hidden)
        Item 1 of Category 1 (Hidden)
        Item 2 of Category 1 (Hidden)
        Item 3 of Category 1 (Hidden)
        Item 4 of Category 1 (Hidden)
      Category 2     
        Item 1 of Category 2     
        Item 2 of Category 2     
    And Scott - thanks for picking up the previous post - for some reason I couldn't for the life of me find that yesterday (in fact I still can't find it when I search).
    Thanks for looking into this.
    Regards,
    John.

  • Capture image with .wim and unattend.xml?

    Hi,
    We captured an image with the default wim of windows 7 + an unattend.xml. Now it seems this unattend.xml was not correctly applied (media center was removed but is still there, some components were installed
    but are not etc). Question: when capturing an image, you CAN use a default .wim right? Or should you use “apply operating system from original installation source” to have it applied correctly?
    Our problem is that our original task sequence had to many Windows updates and crashed. That’s why we are using offline updates which we include in the capture task sequence.
    If we would need to use the "apply operating system from original ..." then we'd need to:
    1.capture without updates
    2.import this wim into sccm
    3.offline update this wim
    4.use this for capture WITH updates
    Please advise. J.
    Jan Hoedt

    Have you tried making a package of your unattended.xml and pointing to it in your Apply Operating system step?
    If I remember correctly SCCM will make it's own unattended.xml even if one exists in the wim file, using the package of the unattended.xml that you have already created will make it use that one. Looks something like this in the task sequence with the highlighted
    yellow parts filled out by your package of the unattended.xml:

  • Import number fields with scale and precision

    When i import data to create a new table, how do i specify the scale and precision when importing ? ...or do i have to create the table manually and then import to an existing table?

    The Data Workshop wizard allows you to specify the scale and precision for numeric columns.

  • Question for load VRML file with scale and position missed

    Hi,
    I trid to read a .wrl file from the "load VRML" vi, most simple .wrl models can be correctly read but for some more compliacted models their scales and positions were incorrect.
    I attached the file which I read the .wrl file and a car model from Matlab Virtual Reality toolbox. The file can be read but their position and scale was missed. I check this model on other VRML readers and I believe the car model is correct. Does anyone know how to fix this problem?
    Thanks,
    -Alex
    Attachments:
    VRMLproblem.zip ‏88 KB

    Hi Yi Y,
    Thanks for your reply.
    The attached files are the correct .wrl file and the one read from LabVIEW.
    The colored is incorrect, the car is seperated to some parts, and the scale of some of the parts are wrong.
    I think you can use any .wrl reader to read the wrl file I posted, all the reader I tried can read it successfully besides LabVIEW.
    In the vi I have you can try to adjust the scale or rotate it then I think you can find the seperated car parts.
    I will appreciate if you can give me any suggestion. Thanks,
    -Alex
    Attachments:
    original.JPG ‏110 KB
    readfromLabView.JPG ‏74 KB

Maybe you are looking for