简体   繁体   English

如何为 SEO 和 Google 的 Pagespeed 优化图像并改进网络节省

[英]How to optimize images for SEO & Google's Pagespeed & Improve web-saving

Pretty much with every Pagespeed test I do for all my website I get the comment "Optimize images by lossless compressing image X" which often increases my page rank a lot.几乎在我为所有网站进行的每一次 Pagespeed 测试中,我都会收到评论“通过无损压缩图像 X 优化图像”,这通常会大大提高我的页面排名。

I already save EVERY image with 'save for web' with Photoshop, but I was wondering how I could "Optimize images by compressing lossless" even more.我已经用 Photoshop 保存了每张图片,但我想知道如何“通过无损压缩来优化图片”。 As far as I know I'm already doing everything I can.据我所知,我已经在尽我所能。

Really wondering..真的很纳闷。。

Off-topic, but I noticed that Google's PageSpeed uses a Retina device to check, since all my Retina images got loaded instead of the regular ones.题外话,但我注意到 Google 的 PageSpeed 使用 Retina 设备进行检查,因为我所有的 Retina 图像都被加载而不是常规图像。 Since these are larger than the area I got a 1/100 score on the mobile segment.由于这些区域大于我在移动部分获得 1/100 分的区域。 Haha.哈哈。

This was a real issue with many of my sites, however I use the free version of kraken to 'loosely compress' all of my images and this passes the Google Test, thus boosting rankings! 这是我很多网站遇到的一个实际问题,但是我使用了免费版本的kraken来“宽松地压缩”我的所有图像,并且通过了Google测试,从而提高了排名!

https://kraken.io/web-interface https://kraken.io/web-interface

I must have used this for well over 10,000 images already! 我一定已经使用了超过10,000张图像!

The images you create in programs like Photoshop and Illustrator look amazing but often the file sizes are very large.您在 Photoshop 和 Illustrator 等程序中创建的图像看起来很棒,但通常文件大小非常大。 This is because the images are made in a format that makes them easier to manipulate in different ways.这是因为图像的制作格式使它们更容易以不同的方式进行操作。 If you put these files on your website it would be very slow to load.如果您将这些文件放在您的网站上,加载速度会非常慢。 Optimizing your images for the web means saving or compiling your images in a web-friendly format depending on what the image contains.为网络优化图像意味着根据图像包含的内容以网络友好的格式保存或编译图像。

How does it work?它是如何工作的? There are two forms of compression that we need to understand, Lossy and Lossless.我们需要了解两种压缩形式,有损和无损。

Images saved in a lossy format will look slightly different than the original image when uncompressed.以有损格式保存的图像在未压缩时看起来与原始图像略有不同。 Keep in mind that this is only visible at a very close look.请记住,这只有在非常接近的情况下才能看到。 Lossy compression is good for web, because images use a small amount of memory, but can be sufficiently like the original image.有损压缩适用于 Web,因为图像使用少量内存,但可以与原始图像足够相似。

Images saved in lossless format retain all the information needed to produce the original image.以无损格式保存的图像保留了生成原始图像所需的所有信息。 For this reason, these images carry a lot more data and in return are a much large file size.出于这个原因,这些图像携带更多的数据,并且作为回报是非常大的文件大小。

We also can optimize images for the web by saving them as the appropriate dimensions.我们还可以通过将图像保存为适当的尺寸来优化网络图像。 Resizing the image on the webpage itself using CSS is helpful but the issue is the web browser will still download the entire original file, then resize it and display it.使用 CSS 调整网页本身的图像大小很有帮助,但问题是网络浏览器仍会下载整个原始文件,然后调整大小并显示它。

Can you imagine taking a poster size image and using it as a thumbnail?你能想象拍摄一张海报大小的图像并将其用作缩略图吗? The little 20px by 20px image would take as long to load as the original poster when we could just be loading a 20px image the whole time.当我们可以一直加载 20 像素的图像时,加载 20 像素乘 20 像素的小图像将花费与原始海报一样长的时间。

How to Optimize Images?如何优化图像?

In simple terms optimizing your image works by removing all the unnecessary data that is saved within the image to reduce the file size of the image based on where it is being used in your website.简单来说,通过删除图像中保存的所有不必要的数据来优化您的图像,以根据图像在您网站中的使用位置来减小图像的文件大小。 Optimizing images for the web can reduce your total page load size by up to 80%.为网络优化图像可以将您的总页面加载大小减少多达 80%。

Full optimization of images can be quite an art to perfect as there are such a wide variety of images you might be dealing with.图像的全面优化可能是一门完美的艺术,因为您可能要处理的图像种类繁多。 Here are the most common ways to optimize your images for the web.以下是优化网络图像的最常用方法。

Reduce the white space around images – some developers use whitespace for padding which is a big no-no.减少图像周围的空白——一些开发人员使用空白作为填充,这是一个很大的禁忌。 Crop your images to remove any whitespace around the image and use CSS to provide padding.裁剪图像以删除图像周围的任何空白并使用 CSS 提供填充。 Use proper file formats.使用正确的文件格式。 If you have icons, bullets, or any graphics that don't have too many colors use a format such as GIF and save the file with lower amounts of colors.如果您有图标、项目符号或任何颜色不多的图形,请使用 GIF 等格式并使用较少的颜色保存文件。 If you have more detailed graphics then use JPG file format to save your images and reduce the quality.如果您有更详细的图形,请使用 JPG 文件格式来保存图像并降低质量。 Save your images in the proper dimensions.以适当的尺寸保存您的图像。 If you are having to use HTML or CSS to resize your images, stop right there.如果您必须使用 HTML 或 CSS 来调整图像大小,请立即停止。 Save the image in the desired size to reduce the file size.以所需大小保存图像以减小文件大小。 To resize your images you will have to use some form of program.要调整图像大小,您必须使用某种形式的程序。 For basic compression, you can use a simple editing program such as GIMP.对于基本压缩,您可以使用简单的编辑程序,例如 GIMP。 For more advanced optimization you will have to save specific files in Photoshop, Illustrator, or Fireworks.要进行更高级的优化,您必须将特定文件保存在 Photoshop、Illustrator 或 Fireworks 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM