What you’ll learn.
- What is a PGM file?
- History of the PGM file
- How to use PGM files
- Pros and cons of PGM files
- How to open a PGM file
- How to create and edit a PGM file
- PGM files: frequently asked questions
What is a PGM file?
PGM (Portable Grey 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 grey in between.
Even though PGMs are the standard for portable graphics, their small file size and colour 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 programmes for and to edit.
The file type uses a plain-text (ASCII) or binary file, containing information on width and height, whitespaces and a grey 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 programmes, advanced graphics programmes and most text programmes. In some cases, you can use PGM files on audio and music editing programmes.
- 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 colour. Grayscale — that is, black, white and shades of grey — is all you get with PGM files. They’re not capable of working with colour.
- 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 programmes can open PGM files on both Windows and Mac computers. You’ll first need to download a compatible programme.
- Start by navigating to your saved file folder.
- Right-click on the file name.
- Click Choose default programme, followed by Browse.
- Launch your file with your selected programme.
- 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 programmes, 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 programmes 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: colour, 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 drop-down File Types menu.