Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesSet a PNG’s intrinsic dimensions with integer width and height attributes, then use CSS to control how it is rendered. For a responsive image, keep the source ratio by setting max-width: 100% and height: auto. For a fixed frame, choose object-fit: contain to show the whole image or cover to fill the frame with possible cropping.
Set the PNG’s intrinsic size in HTML
The simplest form is:
<img src="picture.png" alt="Description" width="1200" height="800">
Replace 1200 and 800 with the PNG file’s actual pixel dimensions. HTML image dimensions are integer pixel values without units; write width="1200", not width="1200px". Supplying both values lets the browser calculate the aspect ratio before the file finishes loading and reserve the correct layout space. MDN Web Docs describes this as enabling the image aspect ratio to be calculated before loading.
What happens when dimensions are omitted?
A PNG without dimensions is normally displayed at its intrinsic size. The browser may have to reflow the page when the image arrives, especially if the image is large or slow to download. Attributes do not compress or resize the file itself; they provide sizing information to the browser.
Make a PNG responsive without stretching
Use the intrinsic dimensions in the markup and a CSS rule for fluid display:
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
<img src="picture.png" alt="Description" width="1200" height="800" class="responsive">
.responsive {
max-width: 100%;
height: auto;
}
The image can shrink to its containing block but will not become wider than its source dimensions. Automatic height preserves the original aspect ratio, so the PNG does not look squashed or stretched.
Ensure the parent can shrink
An image cannot shrink below constraints imposed by its layout. If it sits in a flex or grid item, also check the parent’s width and use min-width: 0 on a flex child when long content prevents shrinking:
.content-column {
min-width: 0;
}
.content-column img {
display: block;
max-width: 100%;
height: auto;
}
display: block removes the small inline baseline gap that can otherwise appear beneath an image.
Use a fixed image box: contain or cover
When every card or thumbnail must have the same box, set both CSS dimensions and choose how the source is fitted:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
<img class="thumbnail" src="picture.png" alt="Description">
.thumbnail {
width: 320px;
height: 200px;
object-fit: contain;
object-position: center;
}
object-fit: contain
contain scales the entire PNG until it fits inside the 320×200 box. No pixels are cropped, but different aspect ratios can leave empty space on two sides (or above and below). This is appropriate for logos, diagrams, screenshots and product images that must remain complete.
object-fit: cover
.thumbnail {
width: 320px;
height: 200px;
object-fit: cover;
object-position: 50% 30%;
}
cover fills the box even when the source ratio differs, so part of the PNG can be cropped. Use object-position to keep an important face, label or subject in view. It is useful for uniform card artwork, but inspect the crop at each responsive breakpoint.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Do not confuse a fixed box with distortion
Setting unrelated width and height values without object-fit can stretch the bitmap. Either preserve the ratio with height: auto, or use contain or cover to define the intended fitting behavior.
Choose the right technique
| Need | Markup or CSS | Result | Trade-off |
|---|---|---|---|
| Reserve space and show at natural ratio | width and height attributes with actual pixels |
Browser knows the ratio before loading | Does not make the file smaller |
| Fluid image in a column | max-width: 100%; height: auto |
Shrinks without distortion | Does not fill a differently proportioned fixed box |
| Uniform frame, no crop | Fixed CSS dimensions plus object-fit: contain |
Whole PNG remains visible | May leave empty space |
| Uniform frame, edge-to-edge art | Fixed CSS dimensions plus object-fit: cover |
Frame is filled | Some image content may be cropped |
| Different files for different displays | srcset/sizes or <picture> |
Browser selects an appropriate source | Requires preparing and maintaining variants |
Serve alternate PNG sizes with srcset and sizes
CSS resizing changes the rendered dimensions, not the bytes downloaded. If you have several PNG exports, let the browser select one:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →<img
src="diagram-800.png"
srcset="diagram-400.png 400w,
diagram-800.png 800w,
diagram-1600.png 1600w"
sizes="(max-width: 600px) 100vw, 800px"
width="1600"
height="1000"
alt="System diagram"
>
The width descriptors tell the browser each candidate’s intrinsic width. sizes describes the slot width the image will occupy; update it to match your layout. Keep the width and height attributes consistent with the selected source’s aspect ratio so layout space can still be reserved.
Use <picture> for art direction
<picture>
<source media="(max-width: 600px)" srcset="diagram-mobile.png">
<img src="diagram-desktop.png" width="1600" height="1000" alt="System diagram">
</picture>
<picture> is useful when mobile and desktop need genuinely different compositions, not merely different resolution. The fallback <img> remains required for accessibility and browsers that do not select a source.
Changing size with JavaScript
Prefer CSS for normal layout. If an interaction changes the rendered size, update a class or CSS custom property rather than repeatedly changing markup attributes:
<img id="preview" src="picture.png" width="1200" height="800" alt="Preview">
<button type="button" id="toggle">Toggle size</button>
<style>
#preview { max-width: 100%; height: auto; }
#preview.large { width: 100%; }
#preview.small { width: 320px; }
</style>
<script>
const preview = document.querySelector('#preview');
document.querySelector('#toggle').addEventListener('click', () => {
preview.classList.toggle('large');
preview.classList.toggle('small');
});
</script>
Keep the intrinsic width and height attributes accurate even when CSS changes the display size. Do not use JavaScript to guess dimensions that are already known from the file.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
PNG sizing edge cases
Transparent backgrounds
Transparent pixels still occupy the PNG’s rectangular canvas. CSS sizes the canvas, not the visible shape. If a logo appears to have extra space, crop the source artwork or use a tighter exported canvas; changing HTML dimensions cannot remove transparent padding.
Very large PNGs
Displaying a 4,000-pixel PNG at 400 CSS pixels can still require downloading and decoding the larger file. Export appropriately sized variants and use srcset where bandwidth matters. CSS alone is not an image-optimization strategy.
High-density displays
A 2× asset can look sharper in a 400 CSS-pixel slot, but its intrinsic file dimensions may be 800 pixels. Record the actual file dimensions in the attributes, then describe the intended slot with CSS or sizes.
Accessibility
Always provide meaningful alt text. If the image is decorative, use alt="". Resizing does not change what assistive technology needs to know.
Troubleshooting PNG size problems
The image is stretched
Check for both CSS dimensions being set to incompatible values. Remove the forced height or add height: auto; for a fixed frame, add object-fit: contain or cover.
The image overflows its container
Apply max-width: 100% and verify that no later rule sets a larger width. In flex layouts, set min-width: 0 on the relevant child. Check for long unbroken content widening the parent.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
There is unexpected blank space
If the box uses contain, the unused area is expected when aspect ratios differ. If the gap is below an otherwise correctly sized inline image, use display: block. Transparent pixels in the source can also look like blank space.
Layout shifts while loading
Add accurate integer width and height attributes, or reserve space with a correctly proportioned CSS box. Do not use guessed dimensions: an incorrect ratio can cause a second layout jump when the PNG loads.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchThe wrong responsive file is downloaded
Review the sizes expression against the real rendered slot width and ensure each srcset descriptor matches the file’s intrinsic width. Browser developer tools can show which candidate was selected.
Or skip the browser setup
If your goal is to obtain a PNG of a webpage rather than size an existing local image, ScreenshotNeo returns a screenshot from one request. It can accept consent banners before capture and remove more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. Every feature is on every plan; 1,000 shots per month are free without a card, and paid plans start at $5 for 3,000 shots.
Use the API documentation at https://screenshotneo.com/docs/ for all options. A minimal cURL request is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The response is an image; change the output extension or request parameters when you need PNG or JPEG. The same request in Python:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →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(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
ScreenshotNeo also supports full-page and selector captures, dark mode, device presets or custom viewports, retina scale, custom CSS and JavaScript, click and wait actions, request blocking, headers, cookies, user agents, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
Frequently Asked Questions
Do HTML width and height attributes use pixels?
Yes. Use integer pixel values without units, such as width="800". CSS declarations use units or percentages.
Can I resize a PNG by changing only its HTML attributes?
You can change the rendered dimensions, but the downloaded PNG file remains the same. Use appropriately sized source files when file weight matters.
Which object-fit value prevents cropping?
Use object-fit: contain. It keeps the complete image visible, although it may leave empty space inside the frame.
Why does my transparent PNG still have visible margins?
Transparent pixels are part of the rectangular canvas. Crop the source file if you need the visible artwork to reach the edges.
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.

