iOS-WebP
Google's WebP image format decoder and encoder for iOS
iOS-WebP
Most apps nowadays enhance user experience with the use of images, and one of the issues I’ve noticed with that is the amount of time it takes to load an image. (Not everyone has the luxury of a fast connection)
Google’s WebP image format offers better compression compared to PNG or JPEG, allowing apps to send/retrieve images with smaller file sizes, reducing request times and hopefully provide a better user experience.
Getting Started
The CocoaPods Way
Usage
Don’t forget to #import <iOS-WebP/UIImage+WebP.h> . There are 3 methods in iOS-WebP , converting images to WebP format, converting images from WebP format, and setting an image’s transparency.
Encoding and decoding of images are done in the background thread and results returned in the completion block on the main thread so as not to lock the main thread, allowing the UI to be updated as needed.
Converting To WebP
WebPPreset possible values
- WEBP_PRESET_DEFAULT (default preset)
- WEBP_PRESET_PICTURE (digital picture, like portrait, inner shot)
- WEBP_PRESET_PHOTO (outdoor photograph, with natural lighting)
- WEBP_PRESET_DRAWING (hand or line drawing, with high-contrast details)
- WEBP_PRESET_ICON (small-sized colorful images)
- WEBP_PRESET_TEXT (text-like)
Config block
If you need to fine tune the performance of the encoding algorithm you can specify overrides to the preset in a config block.
All possible config values can be found in encode.h in the WebPConfig stuct.
Как использовать webp на ios устройствах

Как использовать webp на ios устройствах
Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.
What can I do to prevent this in the future?
If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.
If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.
Another way to prevent getting this page in the future is to use Privacy Pass. You may need to download version 2.0 now from the Chrome Web Store.
Cloudflare Ray ID: 71ae8870d804b7e8 • Your IP : 82.102.23.104 • Performance & security by Cloudflare
Как перевести WebP в JPG или PNG: три рабочих способа
Спорить с тем, что Google подмяла весь интернет под себя, бессмысленно. Эта компания контролирует рынок поисковых систем, а значит, и сайты, их позицию в выдаче и посещаемость, рынок браузеров, где её доля составляет 90%, и рынок интернет-рекламы. Поэтому логично, что Google старается подстроить всё исключительно под себя, в том числе форматы картинок в интернете, которые ей удобно обрабатывать. Но как с этим быть пользователям, — большой вопрос. Ведь формат WebP хоть и был создан специально для работы в интернете, большинству из нас, как ни крути, не подходит.

WebP — это формат, с которым очень неудобно работать напрямую, но который очень хорошо заточен под интернет
WebP – это формат изображений, созданный Google специально для веб-сайтов. Он обеспечивает эффективное сжатие без потерь в качестве. Благодаря им администраторы сайтов снижают вес веб-страниц, тем самым повышая скорость их загрузки и обработки.
А поскольку именно скорость загрузки является одним из показателей, напрямую влияющих на расположение в поисковой выдаче, владельцы сайтов стараются использовать именно WebP, а пользователи, которые скачивают такие картинки, не могут работать с ними без конвертации.
Как сделать JPEG из WebP
Существует несколько способов конвертировать WebP в более удобоваримый для компьютера и штатных инструментов редактирования формат.
Самый простой, но «грязный» – не скачивать картинку, а сделать её скриншот прямо на сайте. Для удобства рекомендую воспользоваться комбинацией клавиш Shift+CTRL+CMD+4. Правда, более-менее приемлемый результат удастся получить только на компьютерах с большим разрешением экрана, а вот на старых MacBook Air, например, качество будет откровенно так себе.
Конвертация картинок на Mac
Способ посложнее состоит в том, чтобы произвести конвертацию прямо на Mac. Несмотря на то что для этого не потребуется дополнительных программных инструментов, этот способ доступен не всем. Во всяком случае, на macOS High Sierra его нет, а значит, он появился только в более новых версиях ОС:
- Сохраните на Mac картинку в формате WebP;
- Откройте её через штатную утилиту «Просмотр»;

В новых версиях macOS есть возможность изменить формат картинки вручную
- В верхнем меню выберите «Файл – «Дублировать»;
- Закройте дубликат, выберите формат JPG и сохраните его.
Ну, и третий способ, который позволяет относительно быстро и без стороннего ПО конвертировать изображения в формате WebP во что-то более привычное, состоит в том, чтобы воспользоваться онлайн-конвертерами.
Онлайн-конвертер картинок
На самом деле их по интернету существует довольно много, но мне привычнее пользоваться iLoveIMG. Он обладает приятным и ненавязчивым интерфейсом и отличается высокой скоростью конвертации.
- Перейдите по этой ссылке на сайт iLoveIMG.com;
- В открывшемся окне выберите раздел Convert to JPG;

Онлайн-конвертация — один из самых простых способов
- Перетащите в окно конвертации изображение с Mac;
- Нажмите Convert to JPG и скачайте готовую картинку.
Зачем нужен WebP
Безусловно, конвертируя изображение, нужно быть готовым к пусть и небольшим, но всё-таки имеющим место потерям качества. Избежать этого не поможет ни конвертация в JPEG, ни в PNG. Даже создание скриншота не позволит сохранить все те аспекты исходного изображения и перенести их на дубликат, сделанный с экрана.

Обратите внимание на вес: слева — JPG, справа — WebP
Поэтому для профессиональной работы такие картинки, само собой, не подойдут. Другое дело, что профессионалы, скорее всего, и не возьмутся за редактирование WebP-изображений. А для бытового использования разницы как таковой заметно не будет.
Впрочем, понять Google тоже можно. Она как никто заинтересована в развитии интернета и прикладывает для этого все усилия. Перевод сайтов на формат изображений WebP — один из шагов по совершенствованию мирового онлайн-пространства. Ведь картинки в таком формате весят на 20-200% меньше, чем PNG или JPEG, а значит, будут быстрее обрабатываться и сократят вероятность закрытия сайта до полной загрузки.
How to add webp support in Safari browser
In my site, I have added all images in webp format. All those images are showing properly in Chrome and Firefox browsers, but they do not show properly in Safari.
![]()
5 Answers 5
The webp format is not supported by Safari as of today, and I’m not sure if it is planned for implementation in the near future. But you can give the browser a choice whether to use webp or jpg like so.
The browsers are smart enough to download and use only the best supported image.
![]()
WebP official support has been added in Safari 14 on macOS Big Sur as well as iOS, iPadOS & company.
- There seems to be an official way to do this now, but as of this moment (Nov 2021) Safari doesn’t support it yet (surprise!).
- Firefox is finally on the image-set bandwagon. It also doesn’t require a prefix.
- Safari is finally supporting WEBP, so this "solution" is no longer useful (unless you want to use it for AVIF or other future formats) see bullet 1.
I don’t have the reputation for commenting, but I wanted to pitch in a (likely temperamental) CSS background solution in addition to the <picture> option.
As of right now, Safari (both versions) is the only main browser to not support WEBP, but it also seems to be the only browser that supports image-set without a prefix.
So, if we use three blocks of code to allow full fallback for all browsers, then it would look something like:
![]()
You can follow the recommendations here to provide WebP format when a browser supports it, and jpg or png if it does not. Here is the gist of it:
For HTML, use the <picture> HTML5 tag:
For CSS:
Add a modernizr.js script to detect if a browser supports WebP format. You can customize the script to only look for the WebP support, and nothing else, to minimize overhead:
This will add either webp or no-webp class to the <html> element, depending of the browser support for WebP:
Use the classes above to load the appropriate images:
To get around the possibility of JavaScript being disabled in the browser and failing to run your modernizr.min.js script , add a class of no-js to the <html> tag:
And add the following before any other scripts:
This will remove the no-js class on the <html> element when executed by the browser, if JavaScript is enabled. Otherwise, it will never be parsed, and the no-js class will stay. Hence, use this class to provide the default image:
The support for WebP image format is available in Safari 14, and it is not possible to support webp images in older Safari versions. You cannot just change the webp files to make them to work on incompatible Safari versions that do not support it. It will not work.
So, for older safari versions, your only solution is to maintain a copy of every image in PNG or JPG format, or use an image CDN to do this automatically for you. Image CDNs take an image file (JPEG or PNG) and convert it on the fly to webp image format if the browser supports it. Otherwise, it delivers the image in JPEG or PNG format to keep things working without any breakage.