Sub topic 15
Check the exported files before publishing
An export that finishes without errors can still be wrong. The canvas may have been resampled to an unexpected size. The color profile may have been dropped. A "transparent" PNG may have a white matte, or a hero image may weigh three times your budget. This chapter gives you a repeatable check to run on every file before it goes live.
This chapter assumes you have already used Export As or Quick Export. It also assumes you know the difference between pixels and print units. For the code, you need Python 3 with Pillow installed (pip install pillow).
What a pre-publish check covers
Each check below ties back to an earlier decision in the export workflow.
| Check | What can go wrong | Where it came from |
|---|---|---|
| Pixel dimensions | Wrong size, wrong aspect ratio, a 1x file named as 2x | Resampling and scales |
| File size | Over a page budget or a platform's upload limit | Quality settings |
| Format and extension | A PNG photo, a JPEG with a logo that needed transparency | Format choice |
| Color profile and appearance | Dull or oversaturated colors, a wide-gamut profile | sRGB conversion |
| Transparency | Unwanted white or black background, jagged edges | Flattening |
| Metadata | Camera data, GPS, or copyright notes you did not intend to ship | Metadata settings |
Work through the table in order. Dimensions and size are cheap to measure, so do them first. Color and transparency need your eyes as well as numbers.
Check dimensions
Open each file's properties in your operating system, or load it in Photoshop and look at Image > Image Size. Compare the result with the target you wrote down before exporting.
Look for these common errors:
- Off by one or two pixels. This happens when a layer's bounds were not on whole pixels. Check the source layer or artboard, not just the export.
- Right width, wrong height. The aspect ratio of the source did not match the destination, and constrain proportions changed one side.
- Retina files with mismatched sizes. A 2x file must be exactly twice the 1x file in both directions. A 1x file of 800 × 533 pairs with a 2x file of 1600 × 1066.
- Print resolution confusion. The PPI value in a file does not change how a browser displays it. Only pixel dimensions matter on screen.
If you serve two widths with srcset, the width descriptors must match the real file widths. The browser trusts the w values and does not measure the files.
<img
src="photo-800.jpg"
srcset="photo-800.jpg 800w, photo-1600.jpg 1600w"
sizes="(max-width: 800px) 100vw, 800px"
width="800" height="533"
alt="Describe the photo">Here photo-800.jpg must really be 800 pixels wide and photo-1600.jpg 1600. The width and height attributes should match the 1x file's size. They let the browser reserve space before the image loads, which prevents layout shift.
Check file size
Look at the size on disk, not the size Photoshop estimated in the dialog. The preview estimate is useful but approximate, and later steps such as metadata embedding can change the total.
Decide on a budget before you check. A page's hero image, a thumbnail, and an icon have very different limits. Social platforms add their own upload limits and may recompress anything over their thresholds. Check the platform's current published requirements each time, because they change.
If a file is over budget, change one lever at a time and re-export:
- Lower JPEG quality in steps and compare the preview.
- Reduce pixel dimensions if the image is displayed smaller than it is exported.
- Switch format, for example a photo from PNG to JPEG or WebP.
- Strip metadata you do not need.
Changing several at once leaves you unsure which one helped or hurt.
Check color
Color is the check people skip, and it is where the most confusing bugs hide. Browsers assume untagged images are sRGB. A file that is still in Display P3 or Adobe RGB but has no profile attached will look dull. A file with an embedded wide-gamut profile can look different between browsers and apps.
Verify two things:
- The file's pixels are in sRGB, either because you converted before export or because Convert to sRGB was on.
- The embedded profile, if any, is sRGB.
In Photoshop, open the exported file and look at the document info or the status bar's profile readout. Then judge the image in a browser, not only in Photoshop. Drag the file into a browser tab and compare it with the original on the same monitor. Small shifts in saturation are normal. Obvious dullness or oversaturation means a profile mismatch.
Also check the color mode. Web formats expect RGB. A CMYK JPEG may display with wrong colors or fail to load in some browsers and apps.
Check transparency
For a file that should be transparent, inspect it on a background that is not white. A white matte is easy to miss on a white page. Place the exported PNG over a dark or colored background in Photoshop, or drop it into a test HTML page with a colored background.
Look for:
- A solid white or black rectangle, which means the file was flattened or saved as JPEG.
- A light halo around cut-out edges, which means the edge pixels were blended with a background color.
- Unexpected transparency in a file that should be solid. This can happen when a layer has partial opacity or the background layer was hidden.
GIF supports only on/off transparency, so soft shadows become hard-edged. If you need soft edges, use PNG or WebP.
Check metadata
Open the file's properties or an EXIF viewer. Confirm that the metadata matches what you chose. Photos taken with a phone may carry location coordinates, device model, and timestamps. If you did not mean to publish those, re-export with metadata set to none or to copyright only.
Keep in mind the trade-off. Metadata adds bytes, but a copyright notice or a profile may be worth it. The point of the check is that the result is deliberate.
Automate the measurable parts
Dimensions, size, profile, and alpha can be read by a script. The script below reports them for every file you pass in and flags files over a size budget. It leaves the visual judgment to you.
import io
import sys
from pathlib import Path
from PIL import Image, ImageCms
MAX_BYTES = 300 * 1024 # adjust to your page budget
def describe(path: Path) -> dict:
size = path.stat().st_size
with Image.open(path) as im:
icc = im.info.get("icc_profile")
if icc:
profile = ImageCms.getProfileDescription(
ImageCms.ImageCmsProfile(io.BytesIO(icc))
).strip()
else:
profile = "none (browsers assume sRGB)"
has_alpha = im.mode in ("RGBA", "LA", "PA") or "transparency" in im.info
return {
"name": path.name,
"format": im.format,
"mode": im.mode,
"width": im.width,
"height": im.height,
"bytes": size,
"profile": profile,
"alpha": has_alpha,
"over_budget": size > MAX_BYTES,
}
def main(paths: list[str]) -> None:
for p in paths:
info = describe(Path(p))
flag = " <-- OVER BUDGET" if info["over_budget"] else ""
print(
f'{info["name"]}: {info["format"]} {info["mode"]} '
f'{info["width"]}x{info["height"]}, {info["bytes"] / 1024:.0f} KB, '
f'profile={info["profile"]}, alpha={info["alpha"]}{flag}'
)
if __name__ == "__main__":
main(sys.argv[1:])Run it as python check_exports.py exports/*.jpg exports/*.png. Treat the output as a list of things to look at, not a verdict. A CMYK mode, a profile that is not sRGB, or alpha=True on a JPEG-named file each deserve a closer look.
You can extend the script with a rule for retina pairs. For example, compare icon-search.png and icon-search-2x.png and assert that the second has exactly twice the width and height of the first.
Check in the real destination
The last check is the destination itself. If you can, upload to a draft or private post, or load the image in a staging page. Look for:
- Cropping that cuts off text or faces, since platforms crop to their own ratios.
- Recompression artifacts, where a platform re-encodes your JPEG and bands appear in gradients.
- Wrong rendering on a high-density phone, where a 1x file looks soft.
If a platform recompresses heavily, exporting at the recommended dimensions and with moderate quality often gives better results than uploading an oversized, high-quality file and letting the platform shrink it.
Exercise
You export badge.png at 1x as 120 × 120 and badge-2x.png for high-density screens. Your script reports badge-2x.png as 240 × 239, alpha=True, profile=none. List which results are problems and what you would do for each.
Show answer
The 239-pixel height is a problem, because a 2x file must be exactly twice the 1x size in both directions (240 × 240). Check the source layer or artboard bounds for a fractional edge, fix it, and re-export. The missing profile is acceptable if the pixels were converted to sRGB, since browsers assume sRGB for untagged images, but confirm the conversion happened before export. alpha=True is correct for a badge that should be transparent, so also view it over a dark background to make sure edges have no halo.
Exercise
A JPEG hero image looks fine in Photoshop but appears washed out in the browser. Name the most likely cause and two ways to check it.
Show answer
The most likely cause is a color profile mismatch, such as pixels left in a wide-gamut space like Adobe RGB without an embedded profile, or a CMYK file. Check the exported file's embedded profile and color mode (for example with the Python script or the profile readout in Photoshop), and open the exported file in a browser next to the original to compare. Fix it by converting to sRGB and RGB mode and re-exporting.