The highest-quality images often start out as RAW files. DSLR cameras capture and hold image data in RAW files, which are typically large and highly detailed because there is no compression. Image generation software can sometimes create RAW files too, but this is less common.
Photographers import and edit their RAW image data in photo-editing software like Photoshop Lightroom, for example. From there, they can adjust the RAW image data for exposure, white balance, color balance, and much more. The last step is to convert the RAW file into a different type of raster image format, resizing and compressing it to fit its intended use, whether it's in print or online.