14,954
edits
mNo edit summary |
|||
| Line 3: | Line 3: | ||
[[Mobile friendliness tool]] | [[Mobile friendliness tool]] | ||
== Image | == Image Compression == | ||
Compression tools to reduce the file size of images | Compression tools to reduce the file size of images | ||
* [https://tinypng.com/ TinyPNG – Compress WebP, PNG and JPEG images intelligently] | * [https://tinypng.com/ TinyPNG – Compress WebP, PNG and JPEG images intelligently] | ||
* Or using [https://imagemagick.org/index.php ImageMagick] to batch compress image files <ref>[https://stackoverflow.com/questions/27267073/imagemagick-lossless-max-compression-for-png ImageMagick: Lossless max compression for PNG? - Stack Overflow]</ref> | * Or using [https://imagemagick.org/index.php ImageMagick] to batch compress image files <ref>[https://stackoverflow.com/questions/27267073/imagemagick-lossless-max-compression-for-png ImageMagick: Lossless max compression for PNG? - Stack Overflow]</ref> | ||
ImageMagick: | |||
<pre> | |||
magick input.jpg -resize 2000x2000\> output.jpg | |||
</pre> | |||
ImageMagick {{kbd | key=<nowiki>\>:</nowiki>}} shrinks only, never enlarges — both dimensions scale proportionally | |||
ffmpeg: | |||
<pre> | |||
ffmpeg -i input.jpg -vf "scale=2000:-1:force_original_aspect_ratio=decrease" output.jpg | |||
# To cap the longer edge at 2000 | |||
ffmpeg -i input.jpg -vf "scale=2000:2000:force_original_aspect_ratio=decrease" output.jpg | |||
</pre> | |||
ffmpeg | |||
* {{kbd | key=<nowiki>scale=2000:-1</nowiki>}}: -1 already preserves aspect ratio; {{kbd | key=<nowiki>force_original_aspect_ratio=decrease</nowiki>}} ensures the longer edge never exceeds 2000, with the shorter edge calculated automatically | |||
* To cap both width and height at 2000 (e.g. for portrait images): {{kbd | key=<nowiki>scale=2000:2000</nowiki>}} | |||
== JavaScript part == | == JavaScript part == | ||