Home  /  Guides  /  What one rotate button does to a batch

What One Rotate Button Does to a Whole Batch

Updated 2026-11-10 · measured on 12 mixed files, 20,934,926 bytes

The short answer

One 90° button is not one operation repeated N times. It is N separate file operations that happen to share one control.

We put twelve files through a single clockwise quarter turn. Eleven came back, one failed to open. Every surviving file swapped width and height and kept exactly the same pixel count, yet the pixels themselves behaved five different ways: four PNGs changed zero pixels, five JPEGs changed between 24.17% and 52.50% of theirs, a WebP changed 60.62%, an animated GIF went from six frames to one, and one of those JPEGs, carrying a phone orientation tag, turned twice if the tag survived. The batch grew by 66,317 bytes, 0.3168% of the input. None of that is visible in a thumbnail grid, which is why a batch can look perfect and still be wrong.

This page is about the files, not about which button to press. To rotate a picture right now, our free image rotator runs in the browser and never uploads anything.

1. The batch, and how the numbers were taken

Twelve files, 20,934,926 bytes on disk, built from one 3000×4000 photograph (12,000,000 pixels, 3,019,770 bytes) plus a synthetic logo, an icon, a sixteen-bit gradient, a six-frame animation and one deliberately truncated JPEG. The whole queue got the same operation: clockwise 90°, saved back in its own format at the same quality setting.

Pixel drift is measured against an exact in-memory quarter turn of the decoded input. That reference is already lossy for JPEG and WebP, so the differences below are the cost of saving again, not a claim about the original scene. Every number on this page was produced by a local script with Pillow 13.0.0 and re-read from the files it wrote.

What the twelve files were: two full-size portrait JPEGs (one a byte-identical duplicate), one landscape JPEG, one square PNG, one transparent RGBA PNG, one lossy WebP, one six-frame GIF, one sixteen-bit PNG, one JPEG with an EXIF orientation tag, one grayscale JPEG, one small PNG icon, and one 1,200-byte truncated JPEG that cannot be decoded.

2. Width and height swap; the pixel count never moves

Rotation by a quarter turn is the one common batch operation where the dimensions trade places. Flipping, inverting and cropping behave differently, and resizing changes the count. Here a 3000×4000 file becomes 4000×3000 with the same 12,000,000 pixels, and a 128×128 icon stays 128×128 with the same 16,384. No file gained or lost a single pixel.

FileIn → outPixelsBytes inBytes out
photo_portrait.jpg3000×4000 → 4000×300012,000,0002,443,4752,459,205
duplicate_photo.jpg3000×4000 → 4000×300012,000,0002,443,4752,459,205
photo_landscape.jpg4000×3000 → 3000×400012,000,0002,403,7042,378,916
gray_8bit.jpg3000×4000 → 4000×300012,000,0002,068,1472,088,411
exif_orient6.jpg2000×1500 → 1500×20003,000,000703,335699,621
photo_square.png3000×3000 → 3000×30009,000,00010,636,84010,694,967
logo_alpha.png1200×800 → 800×1200960,0008,3678,515
screenshot.webp1600×900 → 900×16001,440,000186,788174,410
animation.gif400×300 → 300×400120,0005,3391,074
gray_16bit.png800×600 → 600×800480,00012,04213,068
small_icon.png128×128 → 128×12816,38422,21422,651
broken.jpgcould not be decoded — no output

Three portrait files became landscape, six landscape files became portrait, and two squares stayed square. That is why a folder of mixed phone shots looks rearranged after a batch rotation even when every filename is untouched: the aspect-ratio mix has inverted.

Shape of the 11 surviving files portrait 3 before / 6 after landscape 6 before / 3 after square 2 before / 2 after One 90 degree turn swaps width and height on every file
Figure 1. A mixed queue inverts its own shape. Bar length shows the number of files before the turn.

3. One angle, five different kinds of result

The geometry is identical for all eleven files. The files are not. We compared each saved output, pixel by pixel, against an exact quarter turn of its decoded input. Zero tolerance, all channels.

Format groupChanged pixelsShareMax deltaWhat happened
PNG × 4 (square, RGBA, 16-bit, icon)0 of 10,456,3840%0pixels rearranged, nothing re-encoded
GIF, first frame0 of 120,0000%06 frames in, 1 frame out
JPEG, portrait × 24,007,157 of 12,000,00033.39%27re-encoded, mean absolute delta 0.514654
JPEG, landscape5,508,665 of 12,000,00045.91%31re-encoded, mean 0.787601
JPEG, grayscale2,900,212 of 12,000,00024.17%10re-encoded, mean 0.369553
JPEG, tagged1,574,922 of 3,000,00052.50%46re-encoded, mean 1.280903
WebP, lossy872,919 of 1,440,00060.62%44re-encoded, mean 1.720819

The zero rows are the point. A quarter turn of a PNG is a rearrangement of values already in the file; the encoder writes them out again without approximating anything. The JPEG rows are the same rearrangement followed by a lossy save, so up to 52.50% of the pixels come back a shade different from the reference even though the picture looks identical. A batch that mixes formats is therefore two jobs wearing one button.

Pixels changed by one 90 degree save PNG / GIF 0% JPEG gray 24.17% JPEG port. 33.39% JPEG land. 45.91% JPEG tagged 52.50% WebP lossy 60.62% Reference: exact quarter turn of the decoded input
Figure 2. Same angle, same queue, six different outcomes. Bars are proportional to the changed-pixel share.
Your call: Whether those changed pixels matter depends on where this batch goes next. An archive you will edit again and a set of thumbnails for a web page do not want the same trade. That is a decision about your files, not something a measurement can make.

4. Millions of pixels changed; the byte total barely did

The eleven surviving files went in at 20,933,726 bytes and came out at 21,000,043. That is +66,317 bytes, 0.3168%. Seven files grew, four shrank. The biggest single gain was the square PNG at +58,127 bytes; the biggest loss was the animated GIF, from 5,339 to 1,074 bytes, because five of its six frames did not survive the save.

A quarter turn moves every pixel and changes almost no bytes. Pixel position and file size are answering two different questions.

That near-zero total hides a real spread. The transparent logo grew 148 bytes and kept its full alpha channel. The sixteen-bit PNG stayed in sixteen-bit mode and grew 1,026 bytes. The WebP screenshot shrank 12,378 bytes at the same quality setting. A single "batch got 0.3% bigger" line would be true and useless; the per-file table is the part you would actually check before sending the batch on.

5. The same file twice came back byte-identical

Two of the twelve inputs were byte-identical copies of the same JPEG under different names, sitting at positions 3 and 9 of the queue. Their outputs were also byte-identical: both 2,459,205 bytes, both with SHA-256 prefix e678ccadca9554e7, and both with exactly 4,007,157 changed pixels. Position in the batch did not alter the result.

This is the property a batch depends on. If the same input produced a different file depending on when it was processed, you could not verify a queue by spot-checking, and a re-run would silently drift. A deterministic encoder gives you a cheap check: run one known file twice, at the head and at the tail, and compare hashes.

6. One bad file, two very different outcomes

The truncated JPEG was second in the queue and cost 27.86 milliseconds before the decoder raised an error. What happens next is a design decision, not a technical one. An abort-on-error loop stopped there and delivered 1 file. A skip-and-continue loop delivered 11. Same twelve inputs, same angle, an eleven-fold difference in what you get back.

Batch tools usually report a count, so this is easy to miss: eleven outputs out of twelve inputs looks like a successful run with one bad apple. It is also exactly what an abort looks like if the bad file had been last. Check the count against the queue, and check that the file you expected at the tail actually arrived.

Your call: Whether your tool stops or skips is the difference between one file and eleven. I measured both behaviours in a local loop; I did not measure your tool. Run a two-file test with one broken file in front, and see which one you have before you queue anything that matters.

7. The one that turned twice

One file carried an EXIF Orientation=6 tag, the kind a phone writes when it stores a portrait shot as landscape pixels and tells viewers to turn it for display. We rotated its pixels 90°, then saved it two ways. Stripped of the tag, the output is 699,621 bytes and a viewer shows a 90° turn. With the tag carried over, the output is 699,657 bytes — 36 bytes more — the tag still reads 6, and a viewer adds its own 90° on top of the pixels. The picture appears turned 180°.

Two correct routes exist. Rotate the pixels and clear the tag, or change only the tag and leave the pixels alone. Doing both turns the photo twice, and doing neither leaves it sideways. In a batch this is worse than it is for one image: the same button lands on tagged and untagged files in the same pass, so a handful of files come out wrong while the rest look fine. That is a queue-level problem, not a per-photo one, and a thumbnail grid of forty images will not show it clearly.

This is about what the saved file says after a rotation. Resizing a tagged photo is a different failure with its own numbers, covered in the bulk resizer guide.
Your call: Whether your batch contains phone photos with orientation tags is something only you can check before the run. I built one tagged file on purpose and measured both outcomes. I do not know what is in your folder.

8. The ZIP is smaller than the sum, but not by much

The eleven outputs total 21,000,043 bytes. Zipped with deflate at level 6 they come to 20,750,344 bytes — 249,699 bytes saved, 1.189%. These are already-compressed images, so the archive mostly stores them as-is. If a tool promises that a ZIP will make a batch of JPEGs dramatically smaller, the compression already happened inside the images.

9. What the run cost

The twelve-file pass took 18,122.14 ms end to end on this machine, averaging 1,644.93 ms per successful file. The slowest was a 12,000,000-pixel JPEG at 4,561.8 ms; the 128×128 icon took 47.9 ms. Those numbers are from a local script, not a browser benchmark, and they scale with pixels rather than with file count. Treat them as an order of magnitude, not a promise about your hardware.

10. What was measured, and what was not

Measured: one clockwise 90° pass, in local files, with Pillow 13.0.0, every output re-opened from disk and compared against an exact quarter turn of its decoded input. Bytes, dimensions, pixel differences, frame counts, orientation tags, hashes, ZIP size and timings all come from that run.

Not measured: any online tool, any browser implementation, HEIC, AVIF, TIFF, RAW or camera profiles, arbitrary angles such as 37°, per-file angles inside one queue, lossless JPEG transforms, or colour-profile handling. We also did not test a queue larger than twelve. Where this page says a tool "can" do something, it is describing the file behaviour we reproduced, not a claim about a specific product.

11. A six-step pass before you queue anything

  1. List the queue: filename, format, dimensions, and whether an orientation tag is present. The last column is the one that produces a silent wrong answer.
  2. Pick one route for tagged files — rotate pixels and clear the tag, or change only the tag. Never both.
  3. Pull animations, sixteen-bit files and anything with alpha out of the uniform pass. They do not share the same save path as a JPEG.
  4. Decide what a broken file should do, and make the tool tell you the output count. One file out of twelve is a different result from eleven.
  5. Put a known file at the head and a byte-identical copy at the tail. Compare their hashes after the run; they should match.
  6. Check the delivered count, spot-check the width/height swap on a portrait and a landscape file, and open one tagged photo in a viewer that respects EXIF.

Related guides

Questions people ask

Can I rotate a whole batch of photos 90 degrees at once?

Yes. One angle can be applied to every file in the batch, but it is not one operation: it is one operation per file, and the result depends on each file's format. In a twelve-file run, eleven files rotated and one undecodable file failed. The lossless formats came back with zero changed pixels while the JPEGs came back re-encoded.

Will rotating a batch change my file names or their order?

The rotation itself does not rename anything. In our run every output kept its input filename, and the ZIP listed the eleven surviving files in the same sorted order they went in. What does change is width and height: three portrait files became landscape, six landscape files became portrait, and two squares stayed square. A gallery that sorts by aspect ratio can look reordered even though the filenames did not move.

Does rotating a batch of JPEGs lose quality?

Yes, if the tool re-encodes. Compared against an exact in-memory quarter turn of the decoded input, the five JPEGs that rotated came back with 4,007,157 of 12,000,000 pixels changed (33.39%) on each of the two portrait copies, 5,508,665 (45.91%) on the landscape, 2,900,212 (24.17%) on the grayscale, and 1,574,922 of 3,000,000 (52.50%) on the tagged one. PNG files came back at zero changed pixels. The rotation is exact; the saving is what costs you.

Why did one photo in my batch come out turned the wrong way?

A phone photo can carry an EXIF orientation tag that tells viewers to rotate it for display. We rotated a file tagged Orientation=6 by 90 degrees in pixels. Saved without the tag, a viewer shows a 90 degree turn. Saved with the tag still present, the viewer adds its own 90 degrees on top and shows 180 degrees. Either strip the tag after rotating the pixels, or change only the tag and leave the pixels alone. Mixing the two is what turns a photo twice.

What happens if one file in a batch cannot be opened?

It depends on how the batch is written. We put a truncated JPEG second in a twelve-file queue. An abort-on-error loop stopped there and delivered one file. A skip-and-continue loop delivered eleven. The failing file cost 27.86 milliseconds before the error surfaced, so the cost of a bad file is small; the cost of losing the rest of the batch is not.

Rotate an image in your browser — no upload