Free tools Windows power users keep installed
One-click scans. No signup required.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Improve a LibGDX screenshot by fixing the pixels being rendered before you save them. Capture the correct framebuffer, render at the physical resolution you need, handle alpha explicitly, account for high-DPI scaling, and verify orientation and memory cleanup. Enlarging a PNG after capture cannot restore detail that was never rendered.
1. Capture the framebuffer correctly
The documented LibGDX workflow is to read the rendered framebuffer into a Pixmap, write it with PixmapIO, and dispose the native-memory object when finished. A minimal capture method is:
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.PixmapIO;
import com.badlogic.gdx.files.FileHandle;
public final class Screenshot {
public static void save(String fileName) {
int width = Gdx.graphics.getWidth();
int height = Gdx.graphics.getHeight();
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, width, height);
try {
FileHandle file = Gdx.files.local(fileName);
PixmapIO.writePNG(file, pixmap);
} finally {
pixmap.dispose();
}
}
}
This reads the current back buffer. Call it after your scene has been rendered (and after SpriteBatch.end() or other drawing commands have completed), normally near the end of render(). Calling it before drawing captures a cleared or partially rendered frame.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
The dimensions must match the buffer you intend to read. The screenshot guide uses Gdx.graphics.getWidth() and getHeight(); its transparency example uses getBackBufferWidth() and getBackBufferHeight(). On a high-DPI device those pairs can differ, so inspect both on the target backend rather than assuming logical window units are physical pixels.
#1 Best Overall
Capture after the frame is complete
public void render() {
Gdx.gl.glClearColor(0.08f, 0.08f, 0.10f, 1f);
Gdx.gl.glClear(com.badlogic.gdx.graphics.GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
drawWorld();
batch.end();
if (takeScreenshot) {
Screenshot.save("screenshots/frame-" + System.currentTimeMillis() + ".png");
takeScreenshot = false;
}
}
Clear the screen every frame unless you deliberately depend on persistence. The SpriteBatch documentation also makes blending state part of the result: an incorrect blend mode can make translucent sprites look different in the saved image even when the PNG writer is working correctly.
2. Remove unintended transparency
Layered transparent content can leave alpha values in the captured pixels that do not represent the opaque image you expect. The official screenshot guide describes post-processing in this situation: “However, if your screens have layered transparency, you need to postprocess the screenshot to remove any transparency.”
If the intended deliverable is an opaque screenshot, set every pixel’s alpha byte to 255 before writing. A Pixmap stores color in RGBA8888 format when created from the framebuffer. The following loop preserves red, green, and blue while replacing alpha:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →import com.badlogic.gdx.graphics.Pixmap;
public static void forceOpaque(Pixmap pixmap) {
int width = pixmap.getWidth();
int height = pixmap.getHeight();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int rgba = pixmap.getPixel(x, y);
pixmap.drawPixel(x, y, (rgba & 0x00ffffff) | 0xff000000);
}
}
}
Use this only when transparency is not part of the design. If you need a transparent export, keep the original alpha and investigate the compositing order instead. A screenshot of a transparent scene may look dark, washed out, or unexpectedly different when viewed against another background because RGB values and alpha are being interpreted together.
3. Render enough pixels for the detail you need
Screenshot quality is bounded by the rendered pixel grid. If your game renders a 480×270 back buffer, saving it as a 1920×1080 PNG creates a larger file but not four times the detail. For genuinely higher-resolution output, render the scene into a framebuffer whose dimensions match the desired output, then read that framebuffer.
Rank #2
Render-to-texture with a FrameBuffer
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.PixmapIO;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.files.FileHandle;
FrameBuffer fbo = new FrameBuffer(Pixmap.Format.RGBA8888, 1920, 1080, true);
public void saveHighResolution() {
fbo.begin();
Gdx.gl.glClearColor(0.08f, 0.08f, 0.10f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
drawSceneAtOutputResolution(1920, 1080);
fbo.end();
Pixmap shot = Pixmap.createFromFrameBuffer(0, 0, 1920, 1080);
try {
PixmapIO.writePNG(Gdx.files.local("screenshots/high-res.png"), shot);
} finally {
shot.dispose();
}
}
public void dispose() {
fbo.dispose();
}
This is a controlled render-to-texture path, not an automatic quality switch. Rebuild your projection, camera, UI scale, and any resolution-dependent layout for the target dimensions. Confirm that the device and backend support the requested framebuffer size; the LibGDX documentation does not define one universally safe maximum.
FrameBuffer textures are generally vertically flipped relative to the usual screen coordinate convention. If you display the texture before saving it, use a vertically flipped texture region or invert the relevant texture coordinates. For a direct Pixmap.createFromFrameBuffer capture, still verify orientation on each backend and correct it if your output pipeline shows an upside-down image.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Do not upscale only at the file-writing step
- Changing PNG dimensions after capture increases storage dimensions, not scene detail.
- Rendering at a larger framebuffer can improve small text and edges, but increases GPU work, memory use, and readback cost.
- Supersampling is useful for a fixed export resolution, while ordinary gameplay screenshots should usually match the physical back buffer.
4. Diagnose logical versus physical pixels
LibGDX’s Graphics API exposes screen size, pixel density, framebuffer dimensions, and anti-aliasing information. Log these values on the device and backend where quality is poor:
System.out.println("logical: " + Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight());
System.out.println("back buffer: " + Gdx.graphics.getBackBufferWidth() + "x" +
Gdx.graphics.getBackBufferHeight());
System.out.println("density: " + Gdx.graphics.getDensity());
System.out.println("GL version: " + Gdx.graphics.getGLVersion());
System.out.println("MSAA samples: " + Gdx.graphics.getBufferFormat().samples);
A logical window can be smaller than the physical back buffer on a high-DPI display. If you read the wrong dimensions, the capture can be soft, cropped, or stretched. The FrameBuffer documentation discusses converting dimensions with HdpiUtils and choosing an HDPI mode appropriate to the backend.
HTML5 and mobile iframe cases
The HTML5 backend documentation describes a mobile case in which the reported screen size differs from the physical screen. If a game looks pixelated in an iframe or fullscreen on mobile, inspect the configuration option:
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
// For the HTML5 backend, configure the application according to its backend API.
config.usePhysicalPixels = true;
The exact configuration class differs by backend; use usePhysicalPixels = true where the HTML5 configuration exposes it. Test both modes because physical-pixel rendering can increase workload and alter layout assumptions.
5. Use anti-aliasing deliberately
Graphics information includes framebuffer and anti-aliasing capabilities, but there is no universal switch that guarantees smoother output on every LibGDX backend or device. Inspect the reported sample count and configure multisampling through the backend’s supported settings before creating the application. If the device exposes no samples, changing PNG compression cannot smooth polygon edges.
Compare captures at the same output dimensions with and without multisampling. Evaluate text, diagonal geometry, and sprite edges separately: texture filtering, font rasterization, camera scaling, and MSAA affect different artifacts. Treat any quality or speed improvement as something to measure in your target application; the official documentation publishes no benchmark claiming a specific gain.
6. Keep blending, clearing, and filtering consistent
Clear and compose in a known order
Clear color and depth buffers before drawing the frame unless you intentionally retain them. Draw opaque background layers first, then translucent layers with the intended blend function. A stale blend state can produce halos, dark edges, or incorrect alpha in the screenshot even though the screen looked acceptable during a different frame.
Check texture filtering and camera scale
Nearest filtering preserves deliberately pixel-art edges; linear filtering smooths scaled textures but can blur them when the scale is not an integer. Use a consistent viewport and camera projection for both the live frame and any high-resolution FrameBuffer export. A mismatch between the gameplay camera and export camera is a common cause of apparently different sharpness.
Rank #4
7. Avoid memory and orientation failures
Pixmap uses native heap memory. Dispose every temporary Pixmap, including ones created for failed writes, in a finally block. Dispose long-lived FrameBuffers during application shutdown. Repeated captures without disposal can exhaust native memory even when Java heap usage appears normal.
Do not keep a Pixmap alive merely to display a screenshot unless you need it. If you must process it asynchronously, transfer the data or ownership deliberately and dispose it only after the writer has finished. Test orientation on desktop, Android, iOS, and HTML5 targets because coordinate conventions and framebuffer handling can differ.
8. A practical quality checklist
- Capture only after all scene drawing and batch flushes have completed.
- Log logical size, back-buffer size, density, and sample count on the target device.
- Choose dimensions from the buffer actually being read; use physical pixels when the backend requires them.
- Render to a suitably sized FrameBuffer for high-resolution exports instead of enlarging a small capture.
- Decide whether the result should be transparent. If not, force alpha to 255 after capture.
- Verify vertical orientation, especially when a FrameBuffer texture is displayed or processed.
- Check clearing, blend functions, texture filtering, camera scaling, and font rendering.
- Dispose Pixmaps and FrameBuffers promptly.
- Measure GPU cost, readback stalls, file size, and visual quality on representative hardware.
9. Troubleshooting common problems
The PNG is blank or shows only part of the scene
Capture may be happening before drawing, or the requested rectangle may not match the active back buffer. Move the call after rendering, end the batch, and compare getWidth()/getHeight() with getBackBufferWidth()/getBackBufferHeight().
The image is transparent, dark, or has halos
Inspect alpha and blend state. If an opaque deliverable is intended, apply the alpha-byte post-processing shown above. If transparency is required, composite against a known background and retain correct premultiplied/non-premultiplied assumptions throughout the pipeline.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsThe screenshot is soft or pixelated on a high-DPI display
Log physical and logical dimensions. Read the physical back buffer or render into a higher-resolution FrameBuffer, and review HDPI handling. In HTML5 mobile deployments, test the configuration’s usePhysicalPixels option.
Best Value
The high-resolution capture is upside down
FrameBuffer textures are generally vertically flipped. Correct texture coordinates or flip the image during your processing step, then verify the saved PNG rather than relying only on the on-screen preview.
Captures eventually crash or slow down
Look for undisposed Pixmaps and FrameBuffers. Screenshot readback also synchronizes GPU and CPU work; capture on demand rather than every frame, and measure the pause on the slowest target device.
Edges remain jagged after increasing resolution
More pixels cannot fix geometry rendered without suitable antialiasing or textures scaled with an unsuitable filter. Check the backend’s supported sample count, texture filtering, camera scale, and source asset resolution.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteOr skip the browser setup
If you need a clean image of a web page rather than the LibGDX game’s framebuffer, ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one request. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.
cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
const data = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', data);
See the parameter reference and capture options in the ScreenshotNeo documentation. The service also supports full-page lazy-image loading, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF settings, custom CSS and JavaScript, pre-capture clicks, hidden selectors, selector/delay/network-idle waits, request and resource blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Existing parameter names used by other screenshot APIs also work for easier migration.
An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots, and every feature is available on every plan. Create a free ScreenshotNeo account.
Frequently Asked Questions
Does PNG compression improve a blurry LibGDX screenshot?
No. Compression changes file size and encoding; it cannot add detail absent from the rendered framebuffer.
Should I always use getBackBufferWidth() and getBackBufferHeight()?
Use dimensions matching the buffer you read on the target backend. Compare them with logical dimensions because high-DPI behavior can make the values different.
Can I capture every frame for a video sequence?
You can, but Pixmap allocation, GPU readback, encoding, and native-memory disposal can stall the application. Measure the target hardware and use a dedicated, throttled capture path.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

