DEV Community

Image Splitting Field Notes
Image Splitting Field Notes

Posted on

The Pixel Math Behind Seamless Instagram Carousels

A seamless carousel is a geometry problem before it is an export problem.

If one portrait slide is 1080 × 1350 px, the master canvas must be an exact multiple of 1080 pixels wide:

master_width = slide_width × slide_count
master_height = slide_height
Enter fullscreen mode Exit fullscreen mode

Examples:

Slides Master canvas
3 3240 × 1350
5 5400 × 1350
7 7560 × 1350

Why seams break

The most common failures happen before slicing:

  1. The master image was resized to a width that does not divide into whole pixels.
  2. Text, faces, or logos sit directly on a cut boundary.
  3. Individual tiles are resized again after export.
  4. Filenames do not preserve the posting order.
  5. Different compression settings are applied to different tiles.

A reliable export workflow

  1. Choose the final slide ratio.
  2. Multiply the slide width by the number of slides.
  3. Add guides at every slide boundary.
  4. Finish the composition on the single master canvas.
  5. Export the master once.
  6. Split it into equal horizontal sections.
  7. Test the numbered pieces in an Instagram draft on the actual phone.

For private client artwork, the safest splitter is one that does not upload the source image. I built Image Splitter Online around that constraint: the image is processed locally in the browser, cut lines are previewed before export, and PNG, JPG, WebP, or ZIP output is available without an account.

A small implementation detail

If you are building your own splitter, distribute remainder pixels deterministically instead of rounding every tile independently. For a width W and N columns:

const base = Math.floor(W / N);
const remainder = W % N;

const widths = Array.from(
  { length: N },
  (_, i) => base + (i < remainder ? 1 : 0)
);
Enter fullscreen mode Exit fullscreen mode

That guarantees the exported widths sum back to the source width. It also avoids the one-pixel gaps or overlaps that appear when every cut boundary is rounded separately.

The final check is visual: reconstruct the row from the exported files and verify it matches the master exactly before publishing.

Top comments (0)