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

Preset for Sclices Export


Recommended Posts

Hello 

I will have to Slice up 100s of images like in the picture attached in a 16:9 aspect ratio. Is there any way I can save the slices as a preset so each time I load the image it's just by the click of a button? "Create Export setup preset" is greyed out...

Thanks for the tips

 

 

Screenshot 2022-10-16 at 17.44.01.png

Screenshot 2022-10-16 at 17.54.27.png

Link to comment
Share on other sites

Yeah the way to enable that option is a bit hidden & tricky. - For the selected slice3 in the Slices panel. Look above at your export format setting (where it says 'JPEG' underneath that particular export slice where it says as default '1x') and change that 1x to have some other defined size like '1250w' etc. for the slice. Now click back on the slice itself in the list and go to the 'burger menu' on the Slice panel (the three-lined menu icon at the top right of the panel) and choose 'Create export setup preset...' and call it something sensible/meaningful for you. - Afterwards you can select all your slices and choose your newly create preset from the 'Export preset' dropdown.

create_export.jpg.d0c6757ed4afeae752aaf7e48bf83fa1.jpg

☛ 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

Thank you. But if I understand it correctly, this doesn't speed up the process since the placement of the slices still has to be done manually, no? The preset just defines the output format and resolution but I can't save the placement of the slices, right? What I look for is this: Open File, Go to Export Persona, Have the Slices (2400px x 3200px) applied and then export single frames....if I always have to place the slices manually, that takes forever. 

Link to comment
Share on other sites

On 10/17/2022 at 11:07 AM, GarryP said:

Instead of ‘importing’ the slices into a new document, why not set-up the slices as you need them and then replace the underlying image in the existing document?

how can this be done efficiently? change document name? 

Link to comment
Share on other sites

@Nightjar Just create a document with canvas width equal to the widest image in your set. Then drag and drop all the images to the canvas. Then set up your slices once in Export persona. Note, in Export persona there's Layers panel and Slices panel. Once you've set your slices just toggle layers one by one and click Export slices.

Here's a video for you:

 

 

Link to comment
Share on other sites

On 10/17/2022 at 10:35 AM, Nightjar said:

Thank you. But if I understand it correctly, this doesn't speed up the process since the placement of the slices still has to be done manually, no? The preset just defines the output format and resolution but I can't save the placement of the slices, right? What I look for is this: Open File, Go to Export Persona, Have the Slices (2400px x 3200px) applied and then export single frames....if I always have to place the slices manually, that takes forever. 

Above I was just showing you how to get that export preset option enabled.

If the task is always the same, aka to split a long horizontal image into let's say several 4266 x 2400 px chunks/parts, then I would use an appropriate image splitting tool instead for such purposes!

You can for example do that easily with ImageMagick ...

To simply split your image into quadrants (same size) use crop+repage:

Quote

convert image.jpg -crop 50%x50% +repage piece_%d.jpg

If you need different size quadrants you could cut around a single point:

Quote

convert image.jpg -crop 240x280+0+0 +repage piece_1.jpg
convert image.jpg -crop 0x280+240+0 +repage piece_2.jpg
convert image.jpg -crop 240x0+0+280 +repage piece_3.jpg
convert image.jpg -crop +240+280 +repage piece_4.jpg

There are many different possibilities to do that with ImageMagick, or some other similar tools. There are also some GUI apps for such purposes,  just do a Google search after "image splitting tools"!

There are also online tools for such purposes, like this image splitter one for example.

☛ 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

We also can quickly write our own Python3 script (split-file.py) for such splitting/save as chunks tasks, which then splits a given JPG-file into a given number of horiz peaces ...

from PIL import Image
import os.path
import numpy as np

if __name__ == '__main__':
    from sys import argv, stdout, stderr, exit

    if len(argv) < 5 or len(argv) > 6:
        stderr.write("\n")
        stderr.write("Usage: %s [ -h | --help ]\n" % argv[0])
        stderr.write("       %s split-num  jpg-input-file  output-dir  jpg-output-crop-filename\n" % argv[0])
        stderr.write("\n")
        exit(1)

    pictures = int(argv[1])
    input_file = argv[2]
    outputPath = argv[3]
    baseName = argv[4]

    im = Image.open(input_file)
    x_width, y_height = im.size
    split = np.int64(x_width / 3)
    outputFileFormat = "{0}-{1}.jpg"
    edges = np.linspace(0, x_width, pictures+1)
    num = 0

    for start, end in zip(edges[:-1], edges[1:]):
        box = (start, 0, end, y_height)
        a = im.crop(box)
        a.load()
        outputName = os.path.join(outputPath, outputFileFormat.format(baseName, num + 1))
        num += 1
        a.save(outputName, "JPEG")

This Python script will be used like that ...

   Usage: split-file.py [ -h | --help ]                                                                                                                                 
          split-file.py split-num  jpg-input-file  output-dir  jpg-output-crop-filename

We can call it like this from a console ...

    >   python3 split-file.py 4 './test.jpg' './testdir/' 'cropped'

... which in turn means for the passed over arguments ...

  1. we told the script to split an jpg input file into 4 parts, (split-num = 4)
  2. that the script looks for an existing "test.jpg" file in the same folder the script is executed from (./), (jpg-input-file = './test.jpg')
  3. output should be written in an existing "./testdir/" directory underneath the folder we actually executed the script from, (output-dir = './testdir/')
  4. the generated output file peaces will have a base name of "cropped", and created as "cropped-1.jpg cropped-2.jpg cropped-3.jpg cropped-4.jpg" in "testdir", (jpg-output-crop-filename = 'cropped')

 

 

 

☛ 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

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.