Jump to content
You must now use your email address to sign in [click for more info] ×

PUBLISHER and Filenames of Images


Recommended Posts

No, you would have to add the file names manually.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.3, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.3

Link to comment
Share on other sites

6 hours ago, blackstone said:

Can I do it somehow?

Yes, via external scripting ("wo ein Wille da auch ein Weg oder so ähnlich") you can give that a try.

What you can do and tryout is write and use some python or other appropriate scripting language tool etc. and then create with a script pregenerate SVG files which you import instead into Publisher then.

test-svg.jpg.15b005ed52cd3a839dd9a2f29f0703d9.jpg

Here's a rough 5 min quick'n'dirty made python script which reads all filenames from a given directory path (NOTE that it actually doesn't check if those are all really only image files, thus takes all, so make sure only images are inside a given directory) and then generates an equally named SVG file out of those.

So when reading in a given dir a file called "duffyduck.jpg" it will generate also a "duffyduck.svg" file, which then includes an SVG <image> call to that JPG file and a text string below with the original filename.

The generated SVG file will look like this ...

<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by test.py -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="240" viewBox="0 0 200 240">
<image xlink:href="duffyduck.jpg" height="200" width="200"/>
<text x="20" y="220"> duffyduck.jpg </text>
</svg>

The quick'n'dirty made python script looks like this, where you can adjust with an text editor the SVG command based image (actually sized h=200 w=200 for the <image>) and text sizes (<text> placed at x=20 y=220 pos) as their positionings to the way you need them. NOTE that you best execute that python script then also from inside of the directory where all the images to process are lying in.

import argparse
import os


def files(path):
    for filename in os.listdir(path):
        print("Processing " + filename)
        fname = filename
        fname_no_ext = os.path.splitext(filename)[0]
        f = open(fname_no_ext + ".svg", "w")
        f.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
        f.write("<!-- Generated by test.py -->\n")
        f.write("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n")
        f.write("<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"200\" height=\"240\" viewBox=\"0 0 200 240\">\n")

        write_image = "<image xlink:href=\"{0}\" height=\"200\" width=\"200\"/>\n"
        the_text = "<text x=\"20\" y=\"220\"> {0} </text>\n"
        f.write(write_image.format(fname))
        f.write(the_text.format(fname))
        f.write("</svg>\n")
        f.close()       


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("dirpath",
                        help="the directory path to look for images")
    args = parser.parse_args()
    thePath = args.dirpath
    if not thePath == "":
        print("Using directory path: " + thePath + "\n\n")
        files(thePath)

 

With an installed python environment on your OS you can call that script like this ...

  • python test.py <directory>

Or when the script resides in the same directory as the image files, then ...

  • python test.py .

In case Affinity doesn't parse the <image> ref command, it will probably create the image space and at least place the filename text. - Instead one could also embbed images in SVG directly as base64 encoded bytes then, aka ...

Quote

<image width="200" height="200" xlink:href="data:image/png;base64,...">

or
<image
width="200" height="200" xlink:href="data:image/jpg;base64,...">

... where the dots above mark the place where all the encoded base64 data would be inserted/added then.

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

Another workaround, especially if the image order for your layout is clear:

1. In an image viewer catalog app sort the images in the wanted order.
2. Then select all images > Copy.
3. Switch to a text editor app, set to plain text format, and paste.
4. Use this text file in APub for, possibly linked, image caption text frames.

In case you don't have such an app you alternatively can use the macOS finder (I don't know about copy/paste file names in Windows).

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1 only

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.