2. 为网络准备图像

GIMP最常见的用途之一是为网站准备图像。这意味着图像应该看起来尽可能漂亮,同时保证文件大小尽可能小。本分步指南演示了如何以最小的图像质量损失创建小文件。

2.1. 具有最佳尺寸/质量比的图像

An optimal image for the web depends upon the image type and the file format. Use JPEG for Photographs because they usually have many colors and great detail. An image with fewer colors, such as a button, icon, or screenshot, is better suited to the PNG format.

  1. First, open the image as usual.

    图 6.1. Image of Wilber (the GIMP mascot) opened in RGBA mode

    Image of Wilber (the GIMP mascot) opened in RGBA mode

  2. 图像现在处于 RGB 模式,带有额外的Alpha通道(RGBA)。通常网络图像不需要 Alpha 通道。您可以通过压平图像来移除alpha通道。

    一张照片很少有 alpha 通道,所以图像会以 RGB 模式而不是 RGBA 模式打开;而且您不必删除 Alpha 通道。

    [注意] 注意

    If the image has a soft transition into the transparent areas, you should not remove the alpha channel, since the information used for the transition is not be saved in the file. To export an image with transparent areas that do not have a soft transition, (similar to GIF), remove the alpha channel.

  3. After you have flattened the image, export the image in the PNG format for your web site.

[注意] 注意

You can export your image in the PNG format with the default settings. Always using maximum compression when creating the image. Maximum compression has no effect on image quality or the time required to display the image, but it does take longer to export. A JPEG image, however, loses quality as the compression is increased. If your image is a photograph with lots of colors, you should use jpeg. The main thing is to find the best tradeoff between quality and compression. You can find more information about this topic in 第 5.5.3 节 “Export Image as JPEG”.