AFP-GIC demo / User guide

Try it yourself!

Bring your own image and see what AFP-GIC can reconstruct from a compact bitstream. One trained model, five operating points.

This demo accompanies our IEEE Access paper, Adaptive Fused Prior Transfer for Controllable Generative Image Compression, by Yifei Pei, Ying Liu, and Nam Ling at Santa Clara University. It brings the research into an interactive workflow: compress your own images, inspect the reconstructions, and download real bitstreams for independent decoding.

For the method, experiments, and limitations, read the IEEE Access paper or the arXiv version. The GitHub repository provides the public evaluation code and setup instructions.

1. Compress your image

  1. Open Compress and choose Upload your image. Select a PNG, JPEG or WebP image.
  2. Under Resolution before compression, choose Keep original size to preserve the source dimensions. Or choose Resize before compression and a longest edge of 1024, 1536 or 2048 pixels. Resizing preserves aspect ratio and never enlarges smaller images.
  3. Choose a target bitrate and click Compress image. Targets are operating-point labels; the actual bitrate depends on your image.
  4. Compare the original and reconstruction using the slider. Compression automatically includes decoding, so you can see the result immediately.
  5. Under Result files, download the reconstruction PNG, compressed .afp bitstream or metrics CSV.

2. Decode the bitstream on its own

  1. Switch to Decompress and choose Upload .afp file.
  2. Select the bitstream you downloaded from your live compression result.
  3. Click Decompress file to reconstruct the image, then download the PNG. No original image or manual bitrate selection is needed.

This is lossy compression: decoding reconstructs the image, rather than restoring every original pixel. Decompress accepts this model's .afp files, not JPEG images or ZIP archives.

Exploring the paper examples

The three thumbnails show saved paper results. Select a thumbnail and bitrate to compare them immediately. The compression button is disabled for these precomputed examples; upload your own image to run live compression and obtain a bitstream.

Why is Decompress blank?

The decoder starts with no file selected. Switching tabs does not automatically transfer a compression result. Upload a downloaded .afp file and run decompression to populate the image and statistics.

PSNR and SSIM require an original reference image, so standalone decompression shows image dimensions and bitstream statistics instead.

Understanding the compression ratios

File compression ratio = original file bytes / AFP-GIC bitstream bytes. A ratio of 100:1 means the bitstream occupies one hundredth of the source file size. PNG, JPEG and WebP use different compression schemes, so this ratio depends on the source format as well as image content. It is not a quality-matched comparison against those codecs.

24-bit RGB compression ratio = (width × height × 3) / bitstream bytes = 24 / actual bpp. This compares the bitstream with uncompressed 8-bit RGB pixels at the processed image dimensions, not with the uploaded JPEG or PNG file. It provides a consistent reference across source formats.

For live compression, the denominator is the complete generated .afp file, including its headers. For paper examples, it is calculated from the recorded bpp and image dimensions; those examples do not provide downloadable bitstreams. Neither ratio includes the shared model weights or decoder software, and the reconstruction PNG is not the compressed bitstream.

Original mode preserves the source resolution after EXIF orientation. Resize mode reduces dimensions before compression: its file ratio therefore includes both resizing and compression, as marked on the result. In both modes, the RGB ratio and PSNR/SSIM use the actual encoder input dimensions. A resized result is not a full-resolution quality comparison. The downloaded reconstruction and standalone decode retain the encoded dimensions; they are never enlarged back to the source dimensions. The browser preview alone scales to fit the viewer.

Standalone decompression cannot determine the original file size, so only the RGB ratio is available. These are lossy compression ratios, not evidence of lossless recovery or equal visual quality.

Before you upload

Supported images: PNG, JPEG and WebP, up to 12 MiB and 24 megapixels, with each dimension between 64 and 65535 pixels. These upload limits apply before resizing; the resized image must also have both dimensions at least 64 pixels. Original resolution is the default; resizing only occurs when explicitly selected. The codec pads images internally where required and removes padding on decoding. Large images require more memory and time; requests that exceed available resources may fail rather than silently reduce resolution. Transparency is composited on white. Original file metadata and alpha channels are not preserved.

On ZeroGPU, live requests share a queue and are subject to Hugging Face usage quotas and a 120-second GPU allocation. If a large image cannot be processed, try a smaller resolution. Paper examples do not require a GPU.

Live inference handles one request at a time. The first request may take longer while the model loads. Uploads and live results expire after one hour and are not used for training.

Enjoyed trying AFP-GIC?

If you find this work interesting or useful, please consider starring the project on GitHub and liking the Space on Hugging Face. Your support means a lot to me and helps more people discover this research.

I'm Yifei Pei, the paper's first author. I'm interested in opportunities to bring computer vision and generative-model research into practical ML systems. You can explore more of my work on my GitHub profile. Feedback, research discussions, and collaboration inquiries are welcome.

Open AFP-GIC and try your own image →