.fw files.wiki
JPG

JPG Files

JPEG Image File

A .JPG file is usually a JPEG-compressed raster image used for photos, web graphics, cameras, and email attachments.

JPEG/JFIF Image

Most common
Developer
Joint Photographic Experts Group; JFIF by C-Cube Microsystems
Category
Images
MIME type
image/jpeg
Format
Binary
Magic bytes
FF D8 FF E0
First released
1992
Latest version
ISO/IEC 10918-7:2019; JFIF 1.02
Open standard
Yes

JPEG/Exif Image

Developer
Japan Electronic Industries Development Association / CIPA
MIME type
image/jpeg
Format
Binary
Magic bytes
FF D8 FF E1
First released
1995
Latest version
Exif 3.0
Open standard
Yes

JPEG with SPIFF Header

Developer
Joint Photographic Experts Group
MIME type
image/jpeg
Format
Binary
Magic bytes
FF D8 FF E8
First released
1996
Latest version
ISO/IEC 10918-3
Open standard
Yes

Raw JPEG Codestream

Developer
Joint Photographic Experts Group
MIME type
image/jpeg
Format
Binary
Magic bytes
FF D8 FF DB
First released
1992
Latest version
ISO/IEC 10918-1:1994
Open standard
Yes

Open a .JPG file online

Reading file…

What is a .JPG file?

An extension of type ".JPG" denotes a JPEG single image and an extension of type ".JPEG", the longer one, serves the same purpose where there's allowance for a longer extension. "Jpeg" was originally made by Joint Photographic Experts Group to support continuous-tone photographic images and never for executable program files nor document layout files. The file consists of raster pixels encoded with algorithms of the JPEG kind making this format widely applicable on images shot by cameras or smartphones; website, email or scanned pictures; thumbnails. Most JPG files serve as an interchange file format consisting of JPEG data along with application markers like JFIF or Exif.

The dominant file variant is "JPEG / JFIF": widely spread on the internet and as a general interchange format while another frequently applied variant is "JPEG / Exif" from digital cameras and mobile phones with extra camera info, date, GPS data etc. Much rarer are the files of "JPEG / SPIFF header" file format or raw tables-first JPEG format consisting of Quantization-table-data at the very beginning. The files of the first kinds differ usually with next bytes after the Start of Image marker - FF D8 FF E0 signifies a JFIF; FF D8 FF E1 - Exif; FF D8 FF E8 - SPIFF; FF D8 FF DB is usually considered a raw tables-first JPEG. The common situations users meet are photo albums, websites, social web services, content management system or print labs, camera storage, editors exports.

How to open a .JPG file

Open a .JPG file on Windows

  1. 1 Go to the folder with your file in File Explorer. Usually, downloaded files end up in Downloads.
  2. 2 Double-click your .JPG file if you have an app for .jpg files on your computer. In case it does not open, move on to step three.
  3. 3 Right-click your .JPG file -> select Open with -> Choose another app.
  4. 4 Choose Microsoft Photos in the list (Windows 11: choose Always). For Windows 10 -> put a check on "Always use this app to open .jpg files" and click OK.

Still not opening? See common problems and fixes, or view it in your browser.

Programs for Windows

Open a .JPG file on macOS

  1. 1 In the Finder app, locate your .JPG file.
  2. 2 Just double-click your .JPG file in order to automatically launch the program which is connected with it.
  3. 3 Need another app on your Mac? Control-click the file (or right-click with a mouse). In the pop-up menu select Open With -> Apple Preview.
  4. 4 If it isn't in the list, choose Other… and find the application manually.

Still not opening? See common problems and fixes, or view it in your browser.

Programs for macOS

Open a .JPG file on Linux

  1. 1 Launch your file manager. Depending on the desktop it may be named Files (GNOME), Dolphin (KDE Plasma), Nemo (Cinnamon) or Thunar (Xfce).
  2. 2 Double-click the file.
  3. 3 Or choose another program by right-clicking the file -> Open With -> GIMP.
  4. 4 Install GIMP (if it is not installed on your computer) from the software centre, repository or Flathub.

Still not opening? See common problems and fixes, or view it in your browser.

Programs for Linux

Open a .JPG file on Android

  1. 1 Launch Files or another file management app.
  2. 2 In Downloads, find the .JPG file and open it by tapping.
  3. 3 A list of apps capable of opening the file will be shown. Tap Google Photos and press Always to permanently connect the file type with this app.
  4. 4 No apps able to open this file? Download Google Photos from the Google Play Store.

Still not opening? See common problems and fixes, or view it in your browser.

Programs for Android

Open a .JPG file on iPhone / iPad

  1. 1 Use the Files app and go to On My iPhone, iCloud Drive or Downloads.
  2. 2 Tap the .JPG file you want to open.
  3. 3 If the file can be opened by a built-in iOS app (supported format), it opens automatically.
  4. 4 Touch and hold the file to get the context menu -> choose Share -> select Apple Photos from the list of apps.
  5. 5 If there is no such option, download the app first from the App Store and then tap the document again.

Still not opening? See common problems and fixes, or view it in your browser.

Programs for iPhone / iPad

Open a .JPG file online

  1. 1 Move to the online viewer at the top of this page.
  2. 2 Drag the file there or select it, and its contents will appear in your browser tab. The file is not uploaded.

Still not opening? See common problems and fixes, or view it in your browser.

Programs for Online

More details about opening .JPG files

On Windows OS .JPG file is associated by default with application Microsoft Photos which can crop, resize and annotate the JPEG files or convert it into any other raster format like BMP, PNG, JPEG, TIF and other. Application Paint can crop/annotate/resizing and quickly save image to another image raster formats. The default viewer on macOS is Preview, however Photos application also open and process the same file type as Preview; application Preview is preferable option in case user needs an ability to view image in different orientation mode and annotate it. On Linux operating systems default behavior is opening the image in the default image viewer while GIMP and XnView applications are more suitable to perform some additional tasks. Most popular free/open source applications are also mentioned like digiKam or GraphicsMagick to perform editing and managing actions.

Popular paid options to edit color-profiles JPEG images are Photoshop, Lightroom (it can do raw photos). Popular free solutions are: GIMP (pixel editing); digiKam (JPEG management), Image Viewer XnView MP (browsing/batch conversion and scripting); ImageMagick to execute scripts as magick input.jpg output.png. In the cases when clicking doesn't help, the following troubleshooting steps might be useful. First we need to make sure the file wasn't wrongly saved as some another file, next resetting association to some photo manager application can work or try any web-browser or use some hex editor/file identifier application to look at first bytes of the JPEG. Usually valid image begins with FF D8 FF E0 or FF D8 FF E1.

Technical details

A JPEG file (.JPG extension) is a binary file rather than a textual one which starts either with the SOI (Start of Image) mark 0xFF D8 or with the FFD8 FF E0, FF E1, or FF DB markers and some other header information such as an APP segment which has either "JFIF" followed by version data or the string "Exif" together with two NUL bytes inside APP1 segments. Next go the various marker segments with the compressed data following the DQT (quantization tables), DHT (Huffman tables), SOF (frame headers), and SOS (start of scan). End of file is denoted by the marker FFD9.

Classic baseline JPEG employs 8-bits samples and uses sequential Discrete Cosine Transform coding technique. Progressive encoding, arithmetic compression, hierarchic compression, and loss-less compression are the other modes of JPEG Part I encoding which are not used as extensively, however. Baseline 8-bit huffman-codded JPEG is the mode supported best in browsers and JPEG editing applications nowadays. The typical process of color conversion consists of conversion from RGB to YCbCr color, application of some kind of chroma subsampling 4:2:0, 4:2:2 or alike to reduce chroma resolution, subdivision of the data to 8x8 blocks, quantization of those and entropy-coding using mostly Huffman-coder.

JPEG image format uses markers and not similar to ZIP, while APP0..APP15 segments can precede the actual compressed image and carry some extra blocks of independent information. Such blocks include TIFF IFDs for Exif, GPS information, Orientation information, Embedded JPEGs as thumbnails, ICC Profiles (color calibration), XMP (metadata packets in XML format), iptc:iim metadata, JFIF Density Units flag and Adobe APP14 Transform Flags. There are ITU-T T.81/ISO/IEC 10918-1, ISO/IEC 10918-5 standard for JFIF format, ISO/IEC 10918-3 with SPIFF format, CIPA DC-008 standard for Exif, respectively. MIME is image/jpeg. The JPEG file extension can be one of .jpg, .jpeg, .jpe, .jfif, and sometimes .jif

Typical JPEG file sizes can vary from dozens KB per web-sized photo to megabytes of pictures taken in-camera. It will depend upon the dimensions, picture resolution, and whether you have applied any embedded thumbnailing in metadata sections.

How to convert .JPG files

Convert JPG to PNG, if editing is needed pixel-by-pixel accuracy, if mask makes a transparent picture, when taking a screenshot or drawing diagram or when saving it without introducing new compression.

ImageMagick uses command of the type magick input.jpg output.png. In this case a PNG will maintain all pixel information it got, although lost detail from previous JPEG quantization cannot be regained.

Convert .jpg image into either WebP or AVIF when small size is needed and if you plan to use images for responsive design. There can be commands of the type magick input.jpg -quality 85 output.webp or magick input.jpg -quality 50 output.avif using ImageMagick. Make sure you have appropriate browser and content management system and note that AVIF encoders may work slowly and some older programs cannot even open them yet.

Use command magick input.jpg output.pdf to convert a JPG into PDF if email sending is intended, for printing needs and for filling some form or putting several .jpg images into multi-page PDF.

Convert JPG into TIFF for use at preproduction stage (prepress), in scan workflow, archival or when large number of metadata tags is needed. Command of the type magick input.jpg output.tif is used for this purpose. TIFF format is flexible: it can be lossless or even be uncompressed but existing artifacts introduced at initial creation will not be stripped by conversion.

When dealing in batches with files, ImageMagick works reliably in such way: magick input.jpg -resize 1600x1600 -quality 82 output.jpg. Note that repeated opening and re-saving in JPEG format leads to blocking and ringing artifacts.

Convert toToolCommand / note
PNG ImageMagick magick input.jpg output.png Produces lossless PNG output but cannot restore detail already lost by JPEG compression; file size often increases for photos.
WebP ImageMagick magick input.jpg -quality 85 output.webp Useful for web delivery; WebP can be smaller at comparable visual quality.
AVIF ImageMagick magick input.jpg -quality 50 output.avif AVIF is efficient for web images but encoding is slower and older apps may not open it.
PDF ImageMagick magick input.jpg output.pdf Wraps the image in a PDF for printing or sharing; text remains pixels unless OCR is performed.
TIFF ImageMagick magick input.jpg output.tif Common archival or prepress target; saving to uncompressed/lossless TIFF does not undo previous JPEG artifacts.
BMP ffmpeg ffmpeg -i input.jpg output.bmp Creates an uncompressed bitmap for legacy workflows; output files are much larger.
resized JPG ImageMagick magick input.jpg -resize 1600x1600 -quality 82 output.jpg Good for email or web; recompression is lossy, so keep the original.

Common problems and fixes

Applications to check viewer such as the applications mentioned above including Microsoft Photos, the Apple Preview program, as well as browsers such as Google Chrome or Firefox can throw errors such as "It looks like we don't support this file format" when you attempt to view your jpeg image when its extension is .jpg. Use a hex editor for the analysis of this problem - the first two byte values indicate the start of a JPEG file - normally FF D8 or, for JFIF/Exif, FF D8 FF E0 and FF D8 FF E1 accordingly. When viewing error messages of this sort such as "Invalid JPEG marker type" and "Not a JPEG file: starts with..." you should understand this to be some sort of problem - corruption, download or saving html as file with file extension .jpg, which you might want to re-download from the internet and open in GIMP or any other photo editor before that such as the XnView MP or even the IrfanView.

"Premature end of JPEG file", "Unexpected end of file" error messages appear when the file is cut off before the image end marker FF D9. In most cases, you will not lose the whole image content, however only a part of the picture that comes below would be corrupted. The image rotation can often come from software not reading the Exif Orientation field, and using preview software like Apple Preview, Lightroom or digiKam one can do the Lossless autorotation of image before saving normalized file. "Washed out/watercolor/poor saturation/oversaturated colors" - most likely, there's something about icc profile either stripped completely or not present.

The files that contain very large pixel dimensions tend to overflow viewer or editor limitations although having a small file size - use ImageMagick utility to resize before uploading/downloading. Old viewer applications tend to fail on reading some kind of JPEGs such as progressive JPEG, CMYK/JPEG, Arithmetic coded or even some other exotic variants of it - always do the conversion into baseline JPEG of sRGB colorspace for optimal compatibility. Repeated re-saving of jpeg pictures in editors causes blocky artifacts - these will not go back smoothly by itself - try restoring original jpeg file/master image if possible.

Security considerations

Since the .jpg images don't provide for a macro and script execution infrastructure, opening such a file should be less dangerous compared to loading a document with macros or executable content. The threat is that some bugs exist in image decoding code in browsers, which are written with C and C++ languages. This code has experienced memory problems in the past, so you need to update Chrome, Firefox, Microsoft Photos, Apple Preview, GIMP, ImageMagick, and other libraries frequently with patches. Be careful about suspicious files, including polyglots, corrupted JPG files, or files with unusual names (i.e., photo.jpg.exe) and always show the entire extension name. The exif blocks contain GPS coordinates, timestamps, information about a camera used in particular, its model, lens information and editing history, thumbnail photos and many other details. These must be stripped out before the public exposure with operating system privacy features or using exiftool / strip functions in ImageMagick application.

History and versions

JPEG standardization started in the late eighties with the Joint Photographic Experts Group, being a collaborative body of ISO/IEC and ITU-T concerned specifically with photographic image compression standards. Core specification was finalized as ISO/IEC 10918-1 in 1992, together with the ITU recommendation T.81, specifying the process of encoding the standard JPEG files. Simultaneously in the early nineties, JFIF 1.02, interchange format for regular use in .JPG files, became common and was later standardized as ISO/IEC 10918-5. In 1995, Exif appeared as the format for use in digital cameras and is the primary metadata format in camera-produced JPEGs. In addition, in conjunction with SPIFF defined by JPEG part 3, the file interchange format of JPEG images, JFIF is used and more broadly than the former in regular files. However, progressive JPEG becomes relevant for web transmission since the browser is able to start rendering image on the low quality before the whole file is downloaded while regular JPEG has good backward support. JPEG standard is in wide usage due to near complete support in all web browsers and operating systems as well as cameras and editors.

While .JPEG is the same format with a four-letter extension, .JPG prevailed due to DOS' and first Windows editions’ preference to have a three-letter file extension. With photographs, .JPG still serves to default for an image format used. PNG is known as an efficient tool for creating screenshots since it is both lossless and contains transparent channels; yet, photographic file size will be bigger using PNG images. GIF keeps just 256 colors but allows simple animation making it impossible to use for photographs while remaining common file type for short animations or memes. WebP supports all four mentioned types and generally has more efficient compression compared to a JPG file though in the case when older versions of computer programs are used and not compatible with this new extension - this might cause problems. AVIF can offer even better compression efficiency but at the cost of having an encoding process taking more time along with not always available for certain devices. HEIC, as well as HEIF is popular with iPhone owners. However, for any exchange, the HEIC or HEIF image should be converted into a JPG.

Comments (0)

Replying to

No comments yet. Be the first to share your experience with this file type.