PGM files.

Artists and graphic designers use PGM files to store small 2D images in grayscale. Super accessible and user-friendly, these files are easy to edit. Get the lowdown on their origins, uses, and more.

Explore Creative Cloud

PGM marquee image


What is a PGM file?

PGM (Portable Gray Map) files store grayscale 2D images. Each pixel within the image contains only one or two bytes of information (8 or 16 bits). While that might not sound like a lot of information, PGM files can hold tens of thousands of shades — ranging from pure black to white, and every shade of gray in between.

Even though PGMs are the standard for portable graphics, their small file size and color limitations dinged their reputation and turned them into the “lowest common denominator” of image files. But there are still many great uses for this file type.

History of the PGM file.

Developers created the PGM file format in the US in the late 1980s. Their hallmark is simplicity. PGMs contain a single image that’s both easy to write programs for and to edit.

The file type uses a plain-text (ASCII) or binary file, containing information on width and height, whitespaces, and a gray value. Rows divide the width and height, and each space has a grayscale value — this is what creates the larger image.

How to use PGM files.

Artists, designers, and coding students regularly use PGM files for a variety of reasons.

Black and white photography and art.

People store and share beautiful photographs and art projects in PGM files. They’re ideal for creating a grainy, low-fi, or abstract effect.

Learning to program.

PGMs are one of the building blocks of computer programming. Many new and student programmers begin by studying PGM files and learning how to code, manipulate, and use them in various situations.

Logos, charts, diagrams, cut-outs, and maps.

PGMs are ideal for simple graphics and illustrations. You can use them in sets, pared-back in color and scale, and stacked up in layers. They’re perfect for stark black and white symbols and graphics.

Discover more vector file types

Pros and cons of PGM files.

Explore the advantages and disadvantages of using this file type.

Advantages of PGM files.

  • Compatibility. You can open PGMs in image viewers, photo-editing programs, advanced graphics programs, and most text programs. In some cases, you can use PGM files on audio and music editing programs.
  • Simplicity. Not only are PGM files easy to edit and write, they’re also so simple you can use them as layers within other images.
  • Flexibility. Because they’re so small, PGM files are easy to store. You can paste them into Word docs without increasing the file size. Plus, PGMs quickly load online and easily convert into other photo formats.

Disadvantages of PGM files.

  • No color. Grayscale — that is, black, white, and shades of gray — is all you get with PGM files. They’re not capable of working with color.
  • Image quality. PGM images can only hold a certain amount of information. For very large, detailed images, they’re usually not the best solution.
  • One image limit. If you want to use PGM files and you require more than one image, you’ll have to stack them up in larger files.

How to open a PGM file.

Most image and text editing programs can open PGM files on both Windows and Mac computers. You’ll first need to download a compatible program.

1. Start by navigating to your saved file folder.

2. Right-click on the file name.

3. Click Choose default program, followed by Browse.

4. Launch your file with your selected program.

5. The PGM file should open in its own window.

How to create and edit a PGM file.

While it’s possible to create PGM files with some photo-editing programs, not all of them will allow that. While the files were once ubiquitous, JPEG files have gradually replaced them.

In most cases, users who want to create their own PGM files will need to download and use a dedicated software application or develop them through ASCII code.

PGM files: frequently asked questions.

Can I paste PGM files into a Word document?
PGM files are ideal for tasks like pasting into a Word document. You can easily adjust their dimensions, size, and quality to fit your project.

How do I convert PGM files into other types of photo files?

Both image viewer and photo-editing programs can convert PGM files into other types of photo files. Open the PGM file and then click Save As. Several options will be available.

What is the difference between PGM, JPEG, and TIFF?

In short: color, quality, and size. PGM files are extremely limited in how much information they can store for each pixel in the image. This also makes them smaller.

How do I convert a PGM to JPEG?

You can convert your PGM image to JPEG using Adobe Photoshop.

  • Open Adobe Photoshop.
  • Select File > Open.
  • Choose your PGM image.
  • Select File > Save As.
  • Select JPEG from the dropdown File Types menu.