A simple, containerized web API for taking high-quality screenshots of web pages or specific sections of pages.
# Capture a screenshot of Google's homepage
GET http://localhost:8080/Screenshot?url=https://www.google.com
# Capture a specific section with custom dimensions and wait time
GET http://localhost:8080/Screenshot?url=https://www.example.com&waitTime=5000&x=100&y=200&width=800&height=600&scale=2&format=png- Take screenshots of entire web pages or specific sections
- Control the wait time after page load
- Specify the starting position (X, Y coordinates)
- Customize screenshot dimensions (width, height)
- Adjust scale factor for higher resolution images
- Choose between PNG and JPEG formats
- Docker-ready for easy deployment
- ASP.NET Core 9.0
- PuppeteerSharp for browser emulation
- Docker containerization
GET /Screenshot
Query parameters:
url(required): The URL to take a screenshot ofwaitTime(optional): Wait time after page load in milliseconds (default: 3000ms)x(optional): X coordinate to start screenshot from (default: 0)y(optional): Y coordinate to start screenshot from (default: 0)width(optional): Width of the screenshot in pixels (default: 1280)height(optional): Height of the screenshot in pixels (default: 800)scale(optional): Scale factor for the screenshot (default: 1)format(optional): Image format - "png" or "jpeg" (default: "png")
Example:
GET /Screenshot?url=https://www.example.com&waitTime=3000&x=0&y=0&width=1280&height=800&scale=1&format=png
Parameters:
url(required): The URL to take a screenshot ofwaitTime(optional): Wait time after page load in milliseconds (default: 3000ms)x(optional): X coordinate to start screenshot from (default: 0)y(optional): Y coordinate to start screenshot from (default: 0)width(optional): Width of the screenshot in pixels (default: 1280)height(optional): Height of the screenshot in pixels (default: 800)scale(optional): Scale factor for the screenshot (default: 1)format(optional): Image format - "png" or "jpeg" (default: "png")
Response:
The API returns the image file directly with the appropriate content type.
dotnet run --project JustScreenshotToolBuild the Docker image:
docker build -t justscreenshottool .Run the container:
docker run -p 8080:80 justscreenshottoolThen access the API at http://localhost:8080/Screenshot