Nightjar Posted October 16, 2022 Posted October 16, 2022 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 Quote
v_kyr Posted October 16, 2022 Posted October 16, 2022 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. Quote ☛ 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
Nightjar Posted October 17, 2022 Author Posted October 17, 2022 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. Quote
All Media Lab Posted October 17, 2022 Posted October 17, 2022 Why would you need slices in this case? Is it not an idea to automate it? I don't know what you want to accomplish of course! Go to file > New Batch Job Quote
GarryP Posted October 17, 2022 Posted October 17, 2022 17 hours ago, Nightjar said: 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? 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? User_783649 and Old Bruce 2 Quote
Nightjar Posted October 18, 2022 Author Posted October 18, 2022 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? Quote
User_783649 Posted October 18, 2022 Posted October 18, 2022 @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: Screen Recording 2022-10-18 at 13.18.46.mov Quote
v_kyr Posted October 18, 2022 Posted October 18, 2022 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 ... Using Imagemagick to easily split an image file How to divide photo to X and Y pieces ... and so on ... 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. Quote ☛ 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
v_kyr Posted October 18, 2022 Posted October 18, 2022 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") split-file.py 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 ... we told the script to split an jpg input file into 4 parts, (split-num = 4) that the script looks for an existing "test.jpg" file in the same folder the script is executed from (./), (jpg-input-file = './test.jpg') output should be written in an existing "./testdir/" directory underneath the folder we actually executed the script from, (output-dir = './testdir/') 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') Quote ☛ 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
Recommended Posts
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.