Scribus: How can I find images used twice?

165 Views Asked by At

How can I find images used more than one time in a scribus document?

Is it possible to search a scribus document for images that have been used more than once?

3

There are 3 best solutions below

1
a.l.e On BEST ANSWER

No, not really.

But in "Extras > Manage Image" you can have an overview of the images you have used. It might help you detect duplicates.

You could also write a simple Python script that goes through all images in the document and tells you on which pages you have duplicates...


After your feedback in the comments, I've skimmed through https://wiki.scribus.net/canvas/Category:Scripts and wrote a simple script that lists the path of each image in your document:

import scribus

for page in range(1, scribus.pageCount() + 1):
    scribus.gotoPage(page)
    for item in scribus.getPageItems():
        if item[1] == 2:
            print(scribus.getImageFile(item[0]))

You can easily adapt it to detect duplicated images and do something with them.

You can get further help for the Scribus Python API by going into the help and looking for "For Developers > Scripter API" or in the Scribus Wiki.

And if you produce a script that can be useful for other people do not forget to publish and put a link in here!

1
sid_com On

With this script I get usable data in a text file. From there I can use Perl to filter out images used more then once.


How I executed the script:

Open the sla-file with Scribus.

Select in the Scribus menu bar Scripter -> Show Console which opens a new window: Script Console

In the Script Console menu bar:

File -> Open and select the python script; then

Script -> Run

0
iomonad On

If we reuse the chunk of code shown by a.l.e, we can naively use a hashmap to ensure if image is not already found.

Run as Scribus script:

import scribus

db = {}

for page in range(1, scribus.pageCount() + 1):
    scribus.gotoPage(page)
    for item in scribus.getPageItems():
        if item[1] == 2:
            k = scribus.getImageFile(item[0])
            if k in db:
                db[k] += 1
                print(k, db[k])
            else:
                db[k] = 1