JPG to PGM Converter
Make a grayscale PGM from a color JPG for scripts and research tools, right in your browser.
or drop files here
JPG Format
JPEG image
A lossy photo format with 8 bits per color channel. The .jpg and .jpeg extensions name the same format, and it cannot hold layers.
- Lossy compression
- Color photographs
- No transparency
- Image media type image/jpeg
PGM Format
Portable Gray Map
The grayscale member of the Netpbm family. Raw files start with P5 and plain-text files with P2.
- Gray samples only
- Raw form starts with P5
- Plain form starts with P2
- Maximum value above 255 needs two bytes
How to convert JPG to PGM
Follow these steps to convert JPG to PGM online.
Choose your JPG file, or several at once.
Wait while the converter turns each file into PGM.
Download each new PGM file. Your original file isn't changed.
Related Tools
JPG Compressor
Compress and optimize JPG files
JPG to AI
Convert JPG to AI format
JPG to AVIF
Convert JPG images to AVIF
JPG to GIF
Convert JPG images to GIF format
JPG to ICO
Convert JPG images to ICO format
JPG to JXL
Convert JPG to JXL format
JPG to KTX
Convert JPG to KTX format
JPG to PAM
Convert JPG to PAM format
JPG to PBM
Convert JPG to PBM format
JPG to PCD
Convert JPG to PCD format
JPG to PPM
Convert JPG to PPM format
JPG to XBM
Convert JPG to XBM format
ARW to PGM
Convert ARW to PGM format
AVIF to PGM
Convert AVIF to PGM format
BMP to PGM
Convert BMP to PGM format
CR2 to PGM
Convert CR2 to PGM format
CR3 to PGM
Convert CR3 to PGM format
CUR to PGM
Convert CUR to PGM format
DNG to PGM
Convert DNG to PGM format
ICNS to PGM
Convert ICNS to PGM format
JPEG to PGM
Convert JPEG to PGM format
KTX2 to PGM
Convert KTX2 to PGM format
PBM to PGM
Convert PBM to PGM format
SVG to PGM
Convert SVG to PGM format
What to know before converting JPG to PGM
- Color is gone; the PGM keeps only brightness.
- The PGM is written in the raw P5 form.
- Green counts most toward the gray and blue least.
- EXIF, ICC profiles and XMP are not carried over.
- Each JPG in a batch gives its own PGM.
About JPG files
What is a JPG file?
Most cameras and scanners save their pictures as JPG. Each color channel gets 8 bits, transparency is not available, and fine detail is discarded to keep files small. A file may end in .jpg or .jpeg, and its media type is image/jpeg.
Because the compression is lossy, a PGM made from a JPG cannot recover what the JPG already threw away. Pictures are compressed in blocks of 8x8 pixels, and whatever blockiness is present in the color file remains visible in gray.
Programs that open JPG files
- Windows, Mac and Linux: ImageMagick reads JPG, and GIMP brings one in for editing.
- Web and Mobile: Chrome displays JPG.
- Web: Firefox displays JPG.
- Mobile: Safari displays JPG.
JPG and PGM compared
PGM stands for Portable Gray Map, a Netpbm format that stores only gray samples. A raw file starts with P5 and keeps samples in binary, while a plain file starts with P2 and writes them as decimal text. With a maximum value above 255, each raw sample takes two bytes. The conventional media type is image/x-portable-graymap, and IANA has not registered it. Some Netpbm tools reuse the format for opacity masks, reading the samples as opacity, not brightness.
On this page your browser first decodes the picture, then ImageMagick in WebAssembly produces the PGM.
Other ways to convert JPG to PGM
- Pillow: in Python,
Image.open("photo.jpg").convert("L").save("photo.pgm")applies the ITU-R 601-2 luma transform from the Pillow reference. Pillow reads and writes PGM. - Netpbm: run
jpegtopnm photo.jpg | ppmtopgm > photo.pgm. The ppmtopgm step weights red, green and blue as .299, .587 and .114. - GIMP: load the JPG, then File > Export As with the name photo.pgm; ASCII or RAW is chosen under Data formatting.
Problems with JPG files
- Matching numbers, different results: two editors set to the same quality may compress differently, so a re-saved copy may not look like the first.
- A photo frame rejects the source: some older frames refuse progressive JPEG, so save a copy with progressive mode disabled.
- No editable layers: layers are not stored in a JPG, so hold on to the project file you edited.
Frequently Asked Questions
Everything you need to know about our converter
What are the steps to turn a JPG into a PGM?
Does the PGM have gray levels or only black and white?
How is color turned into gray?
Why would I want a PGM?
What is the difference between P2 and P5?
Can a PGM hold more than 8 bits per pixel?
Are EXIF and color profiles kept?
Does the page take .jpeg files too?
Browse All Tools
Browse by category instead of one giant mixed list.
Convert Tools
Convert image, audio, video, document, and data files directly in your browser.