Rotate PPM images online for free. Fix the orientation of scientific and image-processing output.
PPM (Portable Pixmap) was created by Jef Poskanzer in 1988 as part of the Netpbm toolkit alongside PBM (1-bit) and PGM (grayscale). It is intentionally simple: a tiny ASCII header (P6, width, height, maxval) followed by raw RGB bytes. Because PPM is uncompressed by spec, it is the canonical "intermediate" format in image-processing pipelines — exactly the kind of file that often comes out of a script in the wrong orientation and needs to be rotated before the next stage of the pipeline reads it. Common reasons to rotate a PPM:
.ppm because the format is dead-simple to emit from a few lines of C++. The image-coordinate convention (Y-down vs Y-up) often produces an upside-down render that needs a 180-degree rotation or top-bottom flip.imwrite() and imread() in OpenCV handle PPM natively, and a lot of academic CV code keeps everything in PPM until the final stage. Cameras and capture rigs that feed those pipelines (mounted sideways on robots, drones, or microscope stages) produce PPMs that need a quarter-turn before feature extraction.xwd -> xwdtopnm -> .ppm is still a common path for screenshot capture on legacy X servers, and the resulting PPM may need rotation if the display was in portrait orientation.| Rotation | Pixel-perfect? | Algorithm | Equivalent Netpbm command |
|---|---|---|---|
| 90 degrees clockwise | Yes | Row/column transpose | pamflip -rotate270 (CCW 270 = CW 90) |
| 90 degrees counter-clockwise | Yes | Row/column transpose | pamflip -rotate90 |
| 180 degrees | Yes | Row + column reversal | pamflip -rotate180 |
| Custom angle (e.g. 1.5 degrees) | No (resampled) | Bilinear resample in this editor; Paeth three-shear with anti-aliasing in Netpbm | pnmrotate 1.5 |
| 270 degrees | Yes | Row/column transpose | pamflip -rotate270 |
Quarter-turn rotations on an 8-bit PPM are perfectly lossless because PPM stores raw pixels — there is no quantized DCT block structure (as in JPEG) that constrains alignment. Any width and height work; pixel data is simply transposed. Custom-angle rotations require resampling and produce small triangular regions in the corners. PPM has no alpha, so in a PPM those corners come out white with the default "Transparent" choice under "Background for exposed corners", or black if you pick "Black"; "Auto-crop corners" trims them away, or you can re-crop after rotating with Crop PPM.
| Property | PPM (P6) | PNG | TIFF |
|---|---|---|---|
| Compression | None (raw RGB bytes) | Lossless DEFLATE | Lossless (LZW / DEFLATE / ZSTD) or none |
| File size, 1920x1080 24-bit | ~5.9 MB (fixed) | ~1-3 MB (depends on content) | ~1-6 MB depending on codec |
| Bit depth | 8 or 16 per channel | 1 / 2 / 4 / 8 / 16 | 1 / 8 / 16 / 32 |
| Alpha / transparency | No | Yes | Yes |
| Metadata (EXIF, ICC) | None | tEXt / iCCP chunks | Full EXIF + ICC |
| Created by | Jef Poskanzer (1988) | PNG WG (W3C, 1996) | Aldus / Adobe (1986) |
| Use case | Pipeline intermediate, scientific | Web, lossless distribution | Print, archival, multi-page |
If the rotated PPM is going somewhere a human will look at it, PPM to PNG usually makes more sense as the final step — same lossless quality, ~3-10x smaller. For multi-page archival, PPM to TIFF preserves bit depth and adds compression options.
For mirroring without rotation, see Flip PPM. For other formats, Rotate PNG, Rotate JPG, Rotate TIFF, and Rotate BMP.
Yes, completely. PPM stores raw pixel values with no compression and no quantization, so a 90, 180, or 270 degree rotation is implemented as a row / column transpose — every pixel value in the input appears bit-identical somewhere in the output, just at a transposed position. This is the same operation pamflip -rotate90 performs in the Netpbm command-line toolkit. There is no quality cost regardless of image dimensions (unlike JPEG, which is only lossless on block-aligned dimensions). Two things do change: the editor writes 8 bits per channel, so a 16-bit PPM is saved as 8-bit, and it always writes binary P6, so an ASCII P3 file comes back as P6.
Quarter-turn rotations need only walk the pixel grid once and write the output in a transposed pattern — there is no math per pixel beyond an index permutation. A custom angle (1.5 degrees, 7 degrees, 45 degrees, anything that isn't a multiple of 90) has to resample every pixel. In Netpbm, pnmrotate uses the Paeth three-shear algorithm — three passes over the image with floating-point shear coefficients and per-pixel anti-aliasing weights — and its documentation flags this performance gap and recommends pamflip for any 90-degree case. In this editor a fine angle is one bilinear resample on top of the same decode and save.
Yes — any non-orthogonal rotation creates triangular regions outside the original image rectangle that have to be filled with something. PPM has no transparency channel (it is RGB only, no alpha), so the corners are filled with a solid color: white with the default "Transparent" choice under "Background for exposed corners", or black if you pick "Black". If your image has a uniform white or black background (white scientific plate, black night-sky frame), pick the matching fill and it blends in naturally; if not, pick "Auto-crop corners", crop the rotated rectangle tightly with Crop PPM, or save as PNG with "Save as" to keep transparent corners (PPM to PNG converts without rotating).
No. PPM is intentionally minimal — the only header fields are the magic number (P3 for ASCII or P6 for binary), width, height, and maxval. There is no EXIF, no ICC profile slot, no orientation hint. That means there is no metadata-only "rotate" trick the way there is for JPG; rotating a PPM always means literally moving pixel values. The upside is total predictability: every viewer and every library decodes PPM identically. The downside is that capture-time orientation has to be corrected by a real rotation pass.
Convention. PPM stores rows top-to-bottom (the first pixel after the header is the top-left of the image), but many ray tracers — including the ones in the "Ray Tracing in One Weekend" series, the Peter Shirley graphics textbook, and most CS rendering coursework — work in a math-convention coordinate system where Y increases upward. If the renderer writes its framebuffer in scanline order without flipping, the resulting PPM looks vertically mirrored. Either flip the image during write (for (int j = height-1; j >= 0; --j)) or rotate / flip the PPM after the fact. A 180-degree rotation also flips horizontally, so for a pure vertical flip use Flip PPM instead.
Not here. PPM's maxval header field allows values up to 65535 (per the Netpbm spec at netpbm.sourceforge.net/doc/ppm.html), and the editor opens such files, but it works in 8 bits per channel: a 16-bit PPM is saved as 8-bit P6, for quarter turns and fine angles alike. For HDR scientific imagery and 16-bit microscopy captures, where banding from a downconvert would be visible, rotate with pamflip, which keeps the depth, and keep the original.
Rotating turns the image around its center by an angle: 90 / 180 / 270 / custom. The image content is reoriented as if you had physically turned the paper. Flipping mirrors the image across an axis: a horizontal flip swaps left and right (text becomes mirror-readable), a vertical flip swaps top and bottom. A 180-degree rotation produces the same visual result as a horizontal flip combined with a vertical flip, but is not the same as either flip alone. If you specifically want a vertical flip (the most common case for ray-tracer output written in math Y-up), use Flip PPM.
Yes — drop up to 50 PPM files at once (a mixed batch works too). The rotation angle you set applies to every file in the batch; "Download all (.zip)" saves every rotated result in one ZIP, or use "Download one by one" to save them separately.
For ongoing use inside an image-processing pipeline that consumes PPM (scientific code, OpenCV, classroom rendering frameworks), keep the output as PPM — no extra conversion step, no risk of an upstream library not knowing PNG. For final-distribution use (web, Slack, email, document embedding), rotate first and then convert to PNG via PPM to PNG: a 1920x1080 24-bit PPM is a fixed ~5.9 MB while the equivalent PNG is typically 1-3 MB, identical pixels, and every browser displays it.