Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Find unwanted duplicate photos

New Here ,
Apr 24, 2023 Apr 24, 2023

Hi all,

I produce books with indesign that often have hundreds of pages and even more images.
It happens that I accidentally use the same image twice.
I am looking for a way to search my links to see if there are unwanted duplicates.
Any ideas, scripts which might help?

TOPICS
How to , Scripting
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Apr 24, 2023 Apr 24, 2023

Look into the link panel, any image that is used multiple times is grouped and shown that is used multiple times.

Translate
Community Expert , Apr 24, 2023 Apr 24, 2023

This is a bit crude - just trying to see if it works for you

It will create a text file on your desktop listing the images that are duplicated and what pages they are on

 

var allLinks = app.activeDocument.links;

var imageLinks = {};

for (var i = 0; i < allLinks.length; i++) {
  var linkName = allLinks[i].name;
  var parentObj = allLinks[i].parent;
  var pageNum = parentObj.parentPage.name;
  if (!imageLinks[linkName]) {
    imageLinks[linkName] = [pageNum];
  } else {
    imageLinks[linkName]
...
Translate
Community Expert ,
Apr 24, 2023 Apr 24, 2023

Look into the link panel, any image that is used multiple times is grouped and shown that is used multiple times.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 25, 2023 Apr 25, 2023
LATEST

Thanks much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 24, 2023 Apr 24, 2023

This is a bit crude - just trying to see if it works for you

It will create a text file on your desktop listing the images that are duplicated and what pages they are on

 

var allLinks = app.activeDocument.links;

var imageLinks = {};

for (var i = 0; i < allLinks.length; i++) {
  var linkName = allLinks[i].name;
  var parentObj = allLinks[i].parent;
  var pageNum = parentObj.parentPage.name;
  if (!imageLinks[linkName]) {
    imageLinks[linkName] = [pageNum];
  } else {
    imageLinks[linkName].push(pageNum);
  }
}


var file = new File("~/Desktop/image_links.txt");


file.open("w");

for (var linkName in imageLinks) {
  if (imageLinks[linkName].length > 1) {
    file.writeln(linkName + ': Pages ' + imageLinks[linkName].join(', '));
  } else {
    file.writeln(linkName);
  }
}

file.close();

alert('Image links have been saved to the file "image_links.txt" on your desktop.');
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 25, 2023 Apr 25, 2023

Thanks much!

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines