web圖像_Web圖像優化的基本介紹

web圖像

Images are an essential ingredient of most websites. The visual quality of pictures has a direct impact on the brand image and the message those images convey. And the weight of images usually accounts for a 40-60% of the data transferred on the web.

圖片是大多數網站的重要組成部分。 圖片的視覺質量直接影響品牌形象以及這些形象傳達的信息。 而且圖像的重量通常占網上傳輸的數據的40-60%。

This usually has the largest impact on loading time over other resources like JavaScript. So, whether we're creating or running a website, we should put in place an image transformation and optimization pipeline.

與其他資源(例如JavaScript)相比,這通常對加載時間有最大的影響。 因此,無論是創建網站還是運營網站,都應該建立圖像轉換和優化管道。

There are many options to do this, from in-house developments based on open source libraries and suites – like ImageMagick – to cloud-based tools and APIs.

從基于開源庫和套件的內部開發(例如ImageMagick)到基于云的工具和API,有很多選擇。

Whatever tool we use in our deployment, there are four main tasks that, at the very least, any pipeline should accomplish.

無論我們在部署中使用什么工具,至少有四個管道都應完成四個主要任務。

調整圖像大小。 (Resize images. )

Image resizing is the first and most important step. It brings a big impact on weight with no visual quality penalty, as long as we don't make it smaller than the displaying resolution.

調整圖像大小是第一步,也是最重要的一步。 只要我們不使其小于顯示分辨率,它就會對重量產生重大影響,而不會影響視覺質量。

We should always set and enforce a maximum image resolution in our website, for instance 2000 px width. Ideally, we'd make our website responsive by setting different breakpoints and delivering images that fit in our users' displays.

我們應該始終在網站上設置并強制使用最大圖像分辨率,例如2000 px寬度。 理想情況下,我們將通過設置不同的斷點并提供適合用戶顯示的圖像來使我們的網站具有響應能力。

If you need help on choosing your breakpoints, check out this article on the best image sizes for web.

如果您在選擇斷點時需要幫助,請查看有關適用于Web的最佳圖像尺寸的本文。

轉換為正確的格式。 (Convert to the right format. )

JPEG is the default format in the web. PNG may work better with graphic designs featuring solid colors, but in these cases it may yield lower weight with better quality.

JPEG是網絡中的默認格式。 PNG在具有純色的圖形設計中可能會更好地工作,但是在這些情況下,它可能會產生重量更輕,質量更好的圖形。

You may consider offering WEBP for Chrome, Edge, Firefox and Android users, keeping JPEG as fallback for Safari and iOS. It may save 10-30% of image weight with very similar quality, perhaps some more blur and less ringing.

您可以考慮為Chrome,Edge,Firefox和Android用戶提供WEBP,而將JPEG作為Safari和iOS的后備。 它可以以非常相似的質量節省圖像重量的10%至30%,也許更多的模糊和更少的振鈴。

For an up to date revision you may check out this article on image formats for web.

有關最新版本,您可以查看有關Web圖像格式的本文。

正確壓縮圖像。 (Compress images properly. )

We can do this with a powerful open source suite like ImageMagick and simply set a quality factor (typically 75 to 85) for JPEG (and WEBP) images. You can still use a perceptual metric to better protect quality and further squeeze weight – this is an option available in some cloud image optimization tools.

我們可以使用功能強大的開源套件(例如ImageMagick)來做到這一點,并且只需為JPEG(和WEBP)圖像設置質量因子(通常為75到85)。 您仍然可以使用感知指標來更好地保護質量并進一步壓縮重量-這是某些云圖像優化工具中可用的選項。

擺脫元數據。 (Get rid of metadata. )

From shooting to editing, images accumulate metadata, like exif data. While they may be useful for editing and management purposes, they have no impact on how images show in our web. Their weight can easily get 20 KB or more per image.

從拍攝到編輯,圖像會累積元數據,例如exif數據 。 盡管它們可用于編輯和管理目的,但它們對圖像在我們的網絡中的顯示方式沒有影響。 每張圖像的重量很容易達到20 KB或更多。

We should get rid of metadata before publishing on the web. We only have to make sure that images are coded with the proper orientation and with a sRGB profile, adhering to good color management practices.

在網絡上發布之前,我們應該刪除元數據。 我們僅需確保以正確的方向和sRGB配置文件對圖像進行編碼,即可遵循良好的色彩管理規范。

翻譯自: https://www.freecodecamp.org/news/image-optimization/

web圖像

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/390349.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390349.shtml
英文地址,請注明出處:http://en.pswp.cn/news/390349.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

ElasticSearch客戶端注解使用介紹

The best elasticsearch highlevel java rest api-----bboss 1.ElasticSearch客戶端bboss提供了一系列注解 ESId 用于標識實體對象中作為docid的屬性,該注解只有一個persistent 布爾值屬性,用于控制被本注解標注的字段屬性是否作為普通文檔屬性保存&am…

5827. 檢查操作是否合法

給你一個下標從 0 開始的 8 x 8 網格 board ,其中 board[r][c] 表示游戲棋盤上的格子 (r, c) 。棋盤上空格用 ‘.’ 表示,白色格子用 ‘W’ 表示,黑色格子用 ‘B’ 表示。 游戲中每次操作步驟為:選擇一個空格子,將它變…

團隊的遠程管理_遠程團隊指南:如何管理您的遠程軟件開發團隊

團隊的遠程管理Guides to help you work remotely seem to have swept through the Internet these days. 這些天來,幫助您遠程工作的指南似乎席卷了Internet。 Do this, avoid that, stay productive, and all those run-of-the-mill tips we’ve already tried o…

JS 正則 錢

function ValidateIsDecial(sValue) {return (!sValue && !!!sValue && /^[0-9]{1,10}(\.[0-9]{0,2})?$/.test(sValue)); };驗證 decimal(12,2) 小數點前允許10位,小數點后允許2位 1234567890 true 12345678901 false 0123456789 true 01234567891 false 123.…

5193. 刪除字符使字符串變好

5193. 刪除字符使字符串變好 一個字符串如果沒有 三個連續 相同字符,那么它就是一個 好字符串 。 給你一個字符串 s ,請你從 s 刪除 最少 的字符,使它變成一個 好字符串 。 請你返回刪除后的字符串。題目數據保證答案總是 唯一的 。 示例 …

2020計算機頂級大會_2020年頂級遠程調試工具

2020計算機頂級大會When it comes to debugging, the tool you use is extremely important and can determine how easy is is to fix problems within your code. 在調試方面,您使用的工具非常重要,可以確定在代碼中修復問題的難易程度。 In the earl…

BZOJ5292 洛谷4457 LOJ2513:[BJOI2018]治療之雨——題解

https://www.lydsy.com/JudgeOnline/problem.php?id5292 https://www.luogu.org/problemnew/show/P4457 https://loj.ac/problem/2513 你現在有m1個數:第一個為p,最小值為0,最大值為n;剩下m個都是無窮,沒有最小值或最…

PHP--------微信網頁開發實現微信掃碼功能

今天說說微商城項目中用到的掃一掃這個功能,分享一下,希望對各位有所幫助。 前提:要有公眾號,和通過微信認證,綁定域名,得到相應信息,appid,appsecret等。 微信開發文檔:…

313. 超級丑數

超級丑數 是一個正整數,并滿足其所有質因數都出現在質數數組 primes 中。 給你一個整數 n 和一個整數數組 primes ,返回第 n 個 超級丑數 。 題目數據保證第 n 個 超級丑數 在 32-bit 帶符號整數范圍內。 示例 1: 輸入:n 12,…

初創公司股本結構_我如何向初創公司的開發團隊添加一些結構-以及從過程中學到的東西

初創公司股本結構Until recently, Id spent the last 4 years of my career at FinTech start-ups. Id always worked for smaller companies, and being at a start-up was the next logical step in looking for roles where I could make the biggest difference. 直到最近…

拿什么拯救你,我的面試之——從零打卡刷Leetcode(No.003)

寫在前邊:小詹一直覺得自己編程能力不強,想在網上刷題,又怕不能堅持。不知道有木有和小伙伴和小詹一樣想找個人一起刷題呢?歡迎和小詹一起定期刷leetcode,每周一周五更新一題,每一題都吃透,歡迎…

146. LRU 緩存機制

146. LRU 緩存機制 運用你所掌握的數據結構,設計和實現一個 LRU (最近最少使用) 緩存機制 。 實現 LRUCache 類: LRUCache(int capacity) 以正整數作為容量 capacity 初始化 LRU 緩存 int get(int key) 如果關鍵字 key 存在于緩存中,則返回…

[SQL] 請教一下 count里面有case when 一般情況下啥時候用

http://www.itpub.net/forum.php?modviewthread&tid1810967 問題: 比如 count(case when pday_id${deal_date} then 1 end) 我有點想不明白具體什么情況下count() 這個小括號里面還要用case when 大家做BI統計的時候一般什么情況用啊 還有個…

路由器架設虛擬服務器讓外網訪問到本地網站

確定電腦與路由器正確連接,并且已連至互聯網。在地址欄中輸入192.168.0.1回車,輸入用戶名密碼,進入路由器主界面。 然后點擊左側菜單中的“虛擬服務器”,——“端口段映射”打開“端口段映射”界面。 由于網站用的是80端口&#x…

vue項目示例代碼git_您應該了解的5個Git命令以及代碼示例

vue項目示例代碼gitIve used Git for some years now, and I still find myself googling how to do some basic tasks. So this article is my attempt to learn how to do some of these things by writing about them. And even if I still forget, at least Ill have a ref…

413. 等差數列劃分

413. 等差數列劃分 如果一個數列 至少有三個元素 ,并且任意兩個相鄰元素之差相同,則稱該數列為等差數列。 例如,[1,3,5,7,9]、[7,7,7,7] 和 [3,-1,-5,-9] 都是等差數列。 給你一個整數數組 nums ,返回數組 nums 中所有為等差數組…

山羊與汽車游戲的實驗算法

實驗1: function shuffle(target) {var j, x, i target.length;for (; i > 0; j parseInt(Math.random() * i), x target[--i], target[i] target[j], target[j] x) {}return target }function removeAt(target, index) {return !!target.splice(index, 1).…

selenium模塊

selenium模塊 閱讀目錄 一 介紹二 安裝三 基本使用四 選擇器五 等待元素被加載六 元素交互操作七 其他八 項目練習一 介紹 selenium最初是一個自動化測試工具,而爬蟲中使用它主要是為了解決requests無法直接執行JavaScript代碼的問題selenium本質是通過驅動瀏覽器,完…

關閉iphone來電mac_如何在Mac和iPhone上關閉通用剪貼板切換(以及為什么要禁用此功能)

關閉iphone來電macIm about to tell you something that will shock you, and probably make you very angry. I hope you wont hate me for it. Here goes.我正要告訴您一些令您震驚的事情,并可能使您非常生氣。 我希望你不會為此而恨我。 開始。 If you are an i…

關于tomcat Post 數據參數的問題

2019獨角獸企業重金招聘Python工程師標準>>> POST請求本身并未限制傳入參數大小&#xff0c;是tomcat 容器設置了接收參數大小的限制。修改server.xml <Connector port"8080" protocol"HTTP/1.1" connectionTimeout"2000" red…