Images to PDF Converter – Convert JPG, PNG Images to PDF Online Free

Upload Your Images

Drag & drop files here or click to browse

Supported formats: JPG, PNG, GIF, BMP

About Images to PDF Converter

This Images to PDF tool lets users upload one or more image files and generate a single PDF document from them. The tool first uploads images to the server, stores them temporarily, then converts the selected uploaded images into a PDF file and provides a download link.

The conversion preserves each image’s aspect ratio and places images on separate PDF pages using a fixed page size.

What Does This Tool Do?

This tool performs two main actions:

Upload Images

  • Users can upload images using drag-and-drop or file selection.

  • Images are uploaded to the server and stored in a temporary directory.

  • The server returns file information (name, size, server path) which is used later for conversion.

Convert Images into a PDF

  • Users click “Create PDF” to convert uploaded images into a PDF.

  • A PDF is generated page-by-page where each page contains one image.

  • The PDF is saved on the server and a download path is returned.

Supported File Types

The frontend accepts files that:

  • have an image MIME type (image/*), or

  • match extensions: .jpg, .jpeg, .png, .gif, .bmp, .webp

The backend also validates files by trying to open them as images using PIL and verifying them before saving.

Key Features (Based on Your Code)

Multiple Image Upload

  • Users can upload multiple images at once.

  • All valid images are added to the upload list.

  • Invalid files are ignored at the backend if they fail image verification.

Drag-and-Drop Upload UI

  • The drop area highlights when users drag files over it.

  • Dropped files are assigned to the file input and uploaded automatically.

Temporary Image Storage

  • Uploaded images are saved in:

    • MEDIA_ROOT/temp_image_uploads/

  • Each saved image gets a unique file name using a UUID to avoid conflicts.

File List Display + Remove Option

  • Uploaded images are displayed in a list with:

    • image icon

    • truncated file name

    • file size

    • remove (X) button

  • Removing a file also triggers a server request to delete that file from storage.

PDF Generation With Image Scaling

  • The PDF is created using ReportLab.

  • Page size is fixed to letter.

  • Each image is scaled to fit within margins (50px left/right/top/bottom).

  • Aspect ratio is preserved while resizing.

One Image Per Page

  • Each uploaded image is placed on its own PDF page.

  • The tool creates a new page before drawing each image.

Download PDF

  • After conversion, the user can download the PDF via a download endpoint:

    • /tools/images-to-pdf/download/?file=...

  • The download is served as an attachment with the PDF filename.

Manual Cleanup of Temporary Images

Your code intentionally does not delete images during conversion.
Instead, cleanup happens when:

  • user removes a single file (remove button), or

  • user clicks Clear (clear button), which sends all file paths to the cleanup endpoint.

So temporary images are deleted only when the user clears/removes them (not automatically after conversion).

How the Conversion Works

Step 1: Upload

  • Frontend uploads files to /tools/images-to-pdf/upload/

  • Backend verifies images and saves them

  • Backend returns the server file paths for valid uploads

Step 2: Convert

  • Frontend sends uploaded file paths to /tools/images-to-pdf/convert/

  • Backend reads each image from stored path

  • Creates a PDF in memory

  • Saves the PDF to:

    • MEDIA_ROOT/generated_pdfs/

  • Returns the PDF name and media URL path

Step 3: Download

  • Frontend redirects user to:

    • /tools/images-to-pdf/download/?file=<pdf_name>

  • Backend streams the file as a downloadable PDF attachment

File Deletion / Cleanup Behavior (Important)

Your tool has two types of files:

Temporary uploaded images

  • Stored in temp_image_uploads

  • Deleted when user:

    • removes an image, or

    • clicks Clear

  • Not auto-deleted during conversion

Generated PDFs

  • Stored in generated_pdfs

  • Download endpoint uses this saved PDF file

  • Your code does not include an automatic deletion mechanism for generated PDFs

Frequently Asked Questions

Find answers to common questions about this tool

No. The frontend filters files and only allows image files. On the backend, each uploaded file is verified using an image library, and any file that cannot be opened as an image is silently skipped and not saved.

Only the images that pass verification are saved and returned to the frontend. Invalid or corrupted images are ignored and never added to the conversion list.

Yes, indirectly. Images are added to the PDF in the same order they appear in the uploaded file list. Removing and re-uploading images changes the order.

Yes, all uploaded images are processed securely and are not stored permanently.

Absolutely — the Images to PDF Converter works smoothly on desktop, tablet, and mobile browsers.

It’s commonly used for documents, scanned papers, photo albums, reports, school assignments, and office files.