Urgent.News

What's breaking now, across thousands of outlets.

Tech

Split a Storyboard Grid Into Clean Frames With Pillow

When I split a storyboard sheet, I want each exported file to start at the edge of the actual frame. Dividing the full image width by the column count also divides the borders and gaps, which can leave strips of neighboring panels in the output. I calculate the usable area first: usable width = image width - 2 * margin - (columns - 1) * gap Then I divide that width by the column count and apply…

To split a storyboard sheet into clean frames using Pillow, you first need to determine the usable area within the image. This is done by subtracting the margins and gaps from the total width and height. For the given example, the sheet measures 1024 x 412 pixels, with a 20-pixel margin on each side and 12-pixel gaps between frames.

The script starts by checking that the number of rows and columns, as well as the margin and gap sizes, are all positive. It then opens the source image and calculates the usable width and height by applying the margin and gap adjustments. In this case, the usable width turns out to be 320 pixels, and the usable height is 180 pixels.

Next, the script divides the usable dimensions by the number of columns and rows to find the width and height of each individual frame. Here, each frame measures 320 x 180 pixels. The script then creates a new folder to store the output frames. It iterates through each frame, calculating its top-left corner coordinates based on the row and column indices, and saves the cropped frame as a separate image file named with a two-digit sequential number.

Finally, the script generates a JSON manifest file that contains information about the original image, the dimensions of each frame, and a list of the generated frame filenames. This manifest is saved in the same directory as the output frames. Running the script with the example parameters yields a set of 6 frames, each sized at 320 x 180 pixels, stored in the 'shots' folder.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Ivanti Connect Secure: an exploited privilege escalation and a quieter credential path

Ivanti Connect Secure: an exploited privilege escalation and a quieter credential path Two Ivanti advisories landed in October 2026 that an appliance owner should read as one package, even though they…

  • Ivanti Connect Secure has privilege escalation (CVE-2026-111357) flaw exploited in October 2026
  • Patch cycle challenge: post-exploitation risk between change windows

More from Saturday 24 October →