Dev Blog: Image Tools and Color Utilities for Developers
Web performance and accessibility depend heavily on optimized images and thoughtful color choices. Whether you're compressing images for faster page loads, converting between formats, or testing color accessibility for users with vision impairments, these tools streamline the workflow.
This guide covers the essential graphics utilities developers need — from image optimization to color conversion and accessibility testing.
Image Compression
An image compressor reduces file size while maintaining acceptable visual quality. This is critical for web performance — large images are often the biggest contributor to slow page loads.
Why Image Compression Matters
// Impact on web performance
Original image: 2.4 MB
Compressed (80%): 240 KB (90% reduction)
Compressed (60%): 120 KB (95% reduction)
// Page load improvement
Before: 8 images × 2 MB = 16 MB total
After: 8 images × 200 KB = 1.6 MB total
// Result: 10× faster image loadingCompression Types
- Lossy compression — Removes data permanently, smaller files, slight quality loss (JPEG)
- Lossless compression — No quality loss, moderate size reduction (PNG optimization)
Quality Guidelines
| Use Case | Quality | Notes |
|---|---|---|
| Hero images | 80-90% | High visibility, prioritize quality |
| Product photos | 75-85% | Balance quality and performance |
| Thumbnails | 60-70% | Small display size hides artifacts |
| Background images | 50-70% | Often blurred or overlaid |
The Image Compressor handles PNG and JPEG compression with adjustable quality settings.
Image Resizing
An image resizer changes image dimensions by pixels or percentage. Serving correctly sized images prevents browsers from downloading unnecessarily large files.
Responsive Image Sizing
// Common responsive breakpoints
Mobile: up to 640px wide
Tablet: 641px - 1024px
Desktop: 1025px - 1920px
Retina: 2× pixel density
// Image size recommendations
Mobile hero: 640px × 400px
Desktop hero: 1920px × 600px
Thumbnail: 300px × 300px
Avatar: 128px × 128px
Social share: 1200px × 630px (Open Graph)When to Resize Images
- Before upload — Don't store 4000px images for 400px displays
- Responsive variants — Create multiple sizes for srcset
- Consistent dimensions — Grid layouts need uniform sizes
- Social media — Match platform requirements (OG images, favicons)
Aspect Ratio Preservation
// Original: 1920 × 1080 (16:9)
// Resize by width (maintain ratio)
Width: 640px → Height: 360px (16:9 preserved)
// Resize by percentage
50% → 960 × 540
25% → 480 × 270
// Fixed dimensions may crop or distort
Target: 800 × 800 (1:1)
Options: crop, letterbox, or stretchThe Image Resizer supports resizing by exact dimensions or percentage with aspect ratio preservation.
Image Format Conversion
An image converter transforms images between formats like PNG, JPEG, and WebP. Choosing the right format balances quality, file size, and browser support.
Format Comparison
| Format | Best For | Features |
|---|---|---|
| JPEG | Photos, gradients | Lossy, no transparency, smallest for photos |
| PNG | Graphics, screenshots | Lossless, transparency, larger files |
| WebP | Modern web | Best compression, transparency, 95% browser support |
| GIF | Simple animations | 256 colors max, animation support |
Format Selection Guide
// Decision tree for format selection
Is it a photo or complex image?
├─ Yes → Use JPEG or WebP
│ (WebP is 25-35% smaller than JPEG)
└─ No → Does it need transparency?
├─ Yes → Use PNG or WebP
│ (WebP supports alpha channel)
└─ No → Is it simple graphics/icons?
├─ Yes → Use PNG or SVG
└─ No → Use WebP for best compressionWebP Migration
Converting to WebP typically reduces file size by 25-35% compared to JPEG and PNG while maintaining quality:
// Typical size reductions
photo.jpg: 450 KB → photo.webp: 290 KB (35% smaller)
graphic.png: 200 KB → graphic.webp: 140 KB (30% smaller)
// HTML with fallback
<picture>
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="Description">
</picture>The Image Converter performs lossless conversion between PNG, JPEG, and WebP formats.
Image Boxing & Letterboxing
Image boxing fits images to a specific canvas size by adding padding (letterbox for horizontal padding, pillarbox for vertical). This maintains aspect ratio while achieving consistent dimensions.
Boxing Types
// Letterbox (horizontal bars)
Original: 1920 × 800 (wide)
Canvas: 1920 × 1080
Result: Bars on top and bottom
// Pillarbox (vertical bars)
Original: 1080 × 1920 (tall)
Canvas: 1920 × 1080
Result: Bars on left and right
// Both (centered in larger canvas)
Original: 800 × 600
Canvas: 1920 × 1080
Result: Padding on all sidesUse Cases
- Video thumbnails — Consistent 16:9 thumbnails from varied sources
- Product galleries — Uniform dimensions for grid layouts
- Social media — Fit images to platform aspect ratios
- Print layouts — Standard photo sizes with borders
The Image Boxing tool adds letterbox or pillarbox padding with customizable background colors.
Color Picker & Conversion
A color picker and converter helps developers work with colors across different formats — HEX to RGB, RGB to HSL, and other transformations essential for CSS, design systems, and theming.
Color Format Reference
// Same color in different formats
Color: "Dodger Blue"
HEX: #1E90FF
RGB: rgb(30, 144, 255)
HSL: hsl(210, 100%, 56%)
HSV: hsv(210, 88%, 100%)
// CSS usage
.button {
background-color: #1E90FF; /* HEX */
background-color: rgb(30, 144, 255); /* RGB */
background-color: hsl(210, 100%, 56%); /* HSL */
}When to Use Each Format
| Format | Use Case | Advantage |
|---|---|---|
| HEX | Design specs, CSS | Compact, widely supported |
| RGB | Canvas, WebGL | Matches display output |
| HSL | Theming, variations | Easy to adjust lightness/saturation |
| HSV | Color pickers | Intuitive for selection |
Creating Color Variations with HSL
// Base color
--primary: hsl(210, 100%, 50%);
// Variations by adjusting lightness
--primary-light: hsl(210, 100%, 70%); /* +20% lightness */
--primary-dark: hsl(210, 100%, 30%); /* -20% lightness */
// Variations by adjusting saturation
--primary-muted: hsl(210, 50%, 50%); /* 50% saturation */
--primary-vivid: hsl(210, 100%, 50%); /* 100% saturation */
// This is why HSL is preferred for design systemsThe Color Picker & Converter provides visual color selection and instant conversion between HEX, RGB, HSL, and HSV.
Color Blindness Simulator
A color blindness simulator shows how images and designs appear to users with different types of color vision deficiency. This is essential for accessibility testing and WCAG compliance.
Types of Color Vision Deficiency
// Red-Green Color Blindness (~8% of males)
Protanopia: Missing red cones (1% of males)
Deuteranopia: Missing green cones (1% of males)
Protanomaly: Reduced red sensitivity (1% of males)
Deuteranomaly: Reduced green sensitivity (5% of males)
// Blue-Yellow Color Blindness (rare)
Tritanopia: Missing blue cones (<0.01%)
Tritanomaly: Reduced blue sensitivity (rare)
// Complete Color Blindness (very rare)
Achromatopsia: No color perception (<0.003%)Accessibility Guidelines
- Don't rely on color alone — Use icons, patterns, or text labels
- Ensure sufficient contrast — WCAG requires 4.5:1 for text
- Test with simulators — Verify designs work for all users
- Use colorblind-safe palettes — Blue/orange instead of red/green
Problematic Color Combinations
// Avoid for important distinctions
❌ Red + Green (most common CVD)
❌ Green + Brown (appears similar)
❌ Blue + Purple (tritanopia)
❌ Light green + Yellow
// Safer alternatives
✓ Blue + Orange (distinguishable by most)
✓ Blue + Red (different hue ranges)
✓ Purple + Yellow (high contrast)
✓ Use patterns + color (redundant encoding)Testing Workflow
- Upload design mockup or screenshot
- View through each CVD simulation type
- Check if critical information is still visible
- Verify color-coded elements have redundant indicators
- Test contrast ratios meet WCAG standards
The Color Blindness Simulator supports protanopia, deuteranopia, tritanopia, and other vision simulations for comprehensive accessibility testing.
Graphics Tools Quick Reference
| Task | Tool | Key Features |
|---|---|---|
| Reduce file size | Image Compressor | PNG/JPEG, adjustable quality |
| Change dimensions | Image Resizer | Pixels, percentage, aspect ratio |
| Change format | Image Converter | PNG, JPEG, WebP conversion |
| Add padding | Image Boxing | Letterbox, pillarbox, custom color |
| Color conversion | Color Picker | HEX, RGB, HSL, HSV |
| Accessibility testing | Color Blindness | CVD simulation, WCAG compliance |
Related Tools
Graphics tools work alongside other utilities:
- Base64 Image Encoder — Convert images to data URLs
- QR Code Generator — Create scannable graphics
- Hash Generator — Verify image file integrity
All Image and Color Tools in DevToys Pro
These tools are part of the Colors and Images collections in DevToys Pro. All image processing happens in your browser — your images are never uploaded to external servers.