This project is a small full‑stack web app for doing simple, local file manipulations:
- Convert PDF pages to PNG (single page, range, or all pages)
- Merge multiple PDF files into one document
- Split a PDF by extracting a page range into a new document
- Convert images to WebP
- Convert images to JPG
- Compress images with adjustable quality
- Rotate or flip images
- Remove the background from images
- Convert image DPI for print-ready output
- View, copy and strip image EXIF metadata
The backend is a Flask API and the frontend is a React app (Vite).
These rules define how this project must be implemented and extended:
-
No data can be stored in the backend.
The server must only process files in memory for the current request and immediately return the result. No files or metadata may be written to disk, databases, or any external storage. -
No external API usage.
All functionality must be implemented locally using libraries in this repository. Do not call third‑party web APIs or hosted services. -
Only file‑manipulation features.
New features are welcome as long as they are related to local file manipulation (e.g., format conversion, compression, resizing, merging, splitting, optimizing) and obey Rules 1 and 2.
If you contribute to this repository, you must respect all the rules above.
- Backend: Python, Flask, Flask‑CORS, PyMuPDF (
fitz), Pillow,rembg - Frontend: React, React Router, Vite
pdfToPng/
├── backend/
│ ├── main.py
│ ├── requirements.txt
│ ├── app/
│ │ └── __init__.py
│ ├── blueprints/
│ │ ├── __init__.py
│ │ ├── image.py
│ │ ├── pdf.py
│ │ ├── removebg.py
│ │ ├── rotate_flip.py
| | ├── metadata_viewer.py
| | └── dpi_converter.py
| | ├── merge_pdf.py
| | └── split_pdf.py
│ └── utils/
│ ├── __init__.py
│ └── helpers.py
├── frontend/
│ ├── package.json
│ ├── vite.config.js
│ ├── eslint.config.js
│ ├── index.html
│ ├── README.md
│ ├── public/
│ └── src/
│ ├── main.jsx
│ ├── App.jsx
│ ├── App.css
│ ├── index.css
│ ├── components/
│ │ ├── Layout/
│ │ │ └── Layout.jsx
│ │ └── Sidebar/
│ │ └── Sidebar.jsx
│ ├── hooks/
│ │ └── useFileUpload.js
│ └── pages/
│ ├── LandingPage.jsx
│ ├── PdfPng.jsx
│ ├── ImageWbp.jsx
│ ├── ImageJpg.jsx
│ ├── ImageCompress.jsx
| ├── ImageDpi.jsx
| ├── ImageMetadata.jsx
│ ├── RemoveBg.jsx
│ └── RotateFlip.jsx
├── CONTRIBUTING.md
├── LICENSE
└── README.md
Backend (backend/)
main.py– Entry point for the Flask server; initializes the app and registers blueprintsrequirements.txt– Python dependencies for the backendapp/– Flask app configuration and initializationblueprints/– Modular route handlers for each feature:pdf.py– PDF to PNG conversion endpointimage.py– Image format conversions and compression (WebP, JPG, compress)dpi_converter.py– Image DPI converter endpointmetadata_viewer.py– View and strip metadata endpointremovebg.py– Background removal endpointrotate_flip.py– Rotate/flip endpointmerge_pdf.py– Merge multiple PDFs into one endpointsplit_pdf.py– Split PDF by page range endpoint
utils/– Helper functions and utilities used across blueprints
Frontend (frontend/)
package.json– Node.js dependencies and scriptsvite.config.js– Vite bundler configurationeslint.config.js– ESLint linting rulesindex.html– HTML entry pointsrc/– React source code:main.jsx– React app entry pointApp.jsx– Root React componentcomponents/– Reusable UI components:Layout/– Main page layout wrapperSidebar/– Navigation sidebar
pages/– Page components for each feature:LandingPage.jsx– Main landing pagePdfPng.jsx– PDF to PNG converter pagePdfMerge.jsx– PDF merge pagePdfSplit.jsx– PDF split pageImageWbp.jsx– Image to WebP converter pageImageJpg.jsx– Image to JPG converter pageImageCompress.jsx– Image compression pageImageDpi.jsx– Image DPI converter pageRemoveBg.jsx– Background removal pageImageMetadata.jsx– Metadata view pageRotateFlip.jsx– Rotate/flip page
public/– Static assets
git clone https://github.com/Durgeshwar-AI/pdfToPng.git
cd pdfToPngFrom the backend folder:
cd backend
python -m venv venv
venv\Scripts\activate # On Windows
pip install -r requirements.txt
python main.pyThe Flask server will run at http://localhost:5000.
Available endpoints:
POST /convertPng– Convert first page of a PDF to PNGPOST /merge-pdf– Merge multiple PDFs into onePOST /split-pdf– Extract a page range from a PDFPOST /convertWebP– Convert an image to WebPPOST /removeBg– Remove the background from an imagePOST /convertJpeg– Convert an image to JPGPOST /compress– Compress an image with a quality settingPOST /rotateFlip– Rotate or flip an imagePOST /convert-dpi– Convert image DPI (JPEG, PNG, TIFF, BMP, WebP)POST /check-dpi– Check current DPI of an imagePOST /view-metadata– View image metadataPOST /strip-metadata– Strip metadata from imageGET /health– Health check
All endpoints:
- Process the file in memory
- Do not persist any data on the server
Note: The PDF to PNG tool runs in the browser using PDF.js and supports single page, range, or all pages (ZIP for multi‑page output). The backend still includes /convertPng for server‑side PDF conversion, but the UI uses client‑side rendering by default.
From the frontend folder:
cd frontend
npm install
npm run devBy default, Vite will start the frontend at http://localhost:5173.
Make sure your frontend API calls target http://localhost:5000 for the backend.
The easiest way to get started is using Docker and Docker Compose. This ensures all dependencies (including system tools like poppler-utils) are correctly installed.
From the root directory, run:
docker-compose up --build- Frontend: http://localhost:5173
- Backend: http://localhost:5000
- Health Check: http://localhost:5000/health
The docker-compose.yml is configured for development:
- Hot Reloading: Changes in
backend/orfrontend/will automatically reload the application. - Persistent Models: The
rembgAI models are stored in a Docker volume calledrembg_modelsto avoid re-downloading on every restart.
Contributions are welcome! Before opening an issue or pull request, please read CONTRIBUTING.md.
If this project helped you, please star the repo on GitHub.
Key points:
- Do not add any persistent storage (files, DB, cloud storage, etc.).
- Do not integrate external web APIs or online services.
- New features should be strictly about local file manipulation.
This project is open‑sourced under the MIT License. See LICENSE for details.