search
HomeWeb Front-endPS TutorialPart 5 of the series on the skillful use of photoshop for front-end engineer skills - Sprite pictures

Previous words

As mentioned before, descriptive pictures will eventually be merged into sprite pictures. This article is the fifth article in the series of photoshop skillful uses - Sprite

Definition

CSS sprite (sprite) is a web image application processing method that allows you to All scattered images related to a page are included in one large image. Using the sprite image processing method can achieve two advantages:

  【1】Reduce the number of http requests

  【2】Reduce the image size and improve the web page loading speed (the loading speed of multiple images is less than that of a combined image) Loading speed of synthesized images)

Everything is not perfect. While achieving the advantages, it also brings disadvantages, that is, it increases the development and maintenance costs of the web page.

Application scenarios

As mentioned earlier, not all pictures can be used to make sprite pictures, only descriptive pictures are suitable

【1】Content pictures set in the img tag cannot be merged into sprite images. Merging these pictures will affect the readability of the page, reduce the semantics and the adjustable range is small

 【2】For Images that are tiled both horizontally and vertically cannot be merged into sprite images. If it is tiled horizontally, all the pictures tiled horizontally can only be merged into one large picture, which can only be arranged vertically, not horizontally; if it is tiled vertically, all pictures tiled vertically can only be merged into one large picture. It can only be arranged horizontally, not vertically

前端工程师技能之photoshop巧用系列第五篇——雪碧图

Merge

The production of sprite pictures is actually to merge sporadic small pictures into one big picture, but the small pictures are merged The following rules need to be followed:

[1] The image must leave a gap before merging

1. If it is a small icon, the gap can be appropriately smaller, usually about 20 pixels

 2. If it is a large icon, the gap to be left should be larger, because when the large icon is adjusted, the space affected will be larger

前端工程师技能之photoshop巧用系列第五篇——雪碧图

## 【 2] Pictures are arranged horizontally and vertically

前端工程师技能之photoshop巧用系列第五篇——雪碧图 ## [3] Principles of merging and classifying

There are three principles of merging and classifying, which are based on modules and based on Size and color-based

a. Merge pictures belonging to the same module

前端工程师技能之photoshop巧用系列第五篇——雪碧图 b. Merge pictures of similar size

前端工程师技能之photoshop巧用系列第五篇——雪碧图 c. Merge pictures with similar colors

##【4】Merge recommendation前端工程师技能之photoshop巧用系列第五篇——雪碧图

In the actual sprite production , generally use two methods: one is to merge images used only on this page; the other is to merge stateful icons

前端工程师技能之photoshop巧用系列第五篇——雪碧图

Implementation

In the past, we might need to manually implement the sprite image, which was a very troublesome and error-prone thing. Nowadays there are many convenient tools for making sprites. I often use a little tool called the css background merge tool.

The usage method is shown in the figure below:

前端工程师技能之photoshop巧用系列第五篇——雪碧图

Maintenance

【Enlarge canvas】

Image-> Canvas size -> Select positioning position (usually the upper left corner)

前端工程师技能之photoshop巧用系列第五篇——雪碧图

# [Reduce canvas]

[Note] The color mode of PNG8 defaults to index color mode. When modifying the png8 image, you need to change its color mode to RGB mode. The steps are Image-> Mode-> ; RGB color

#   1. Select the image- > Cropping selection is based on the pixel color in the upper left corner, which can achieve automatic cropping effect
前端工程师技能之photoshop巧用系列第五篇——雪碧图

##  2. First select the area you want to keep, and then select the image-> Crop or select the crop tool button in the toolbar to crop
前端工程师技能之photoshop巧用系列第五篇——雪碧图
前端工程师技能之photoshop巧用系列第五篇——雪碧图 前端工程师技能之photoshop巧用系列第五篇——雪碧图

1. If the icon is an independent layer, just drag it with the move tool
前端工程师技能之photoshop巧用系列第五篇——雪碧图 前端工程师技能之photoshop巧用系列第五篇——雪碧图 ##【Move icon】

前端工程师技能之photoshop巧用系列第五篇——雪碧图

 2. If the icon is a non-independent layer

 a. First use the selection tool to select the icon area, and then use the move tool to drag the icon, so that the layer can be moved

 b. First use the selection tool to select the icon area, then cut , and paste . The original layer can be divided into two layers, which is more convenient for operation

前端工程师技能之photoshop巧用系列第五篇——雪碧图 前端工程师技能之photoshop巧用系列第五篇——雪碧图
##More front-end engineer skills in photoshop Part 5 of the Skillful Use Series - Sprite Pictures For related articles, please pay attention to the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do I use Photoshop for creating social media graphics?How do I use Photoshop for creating social media graphics?Mar 18, 2025 pm 01:41 PM

The article details using Photoshop for social media graphics, covering setup, design tools, and optimization techniques. It emphasizes efficiency and quality in graphic creation.

How do I prepare images for web use in Photoshop (file size, resolution, color space)?How do I prepare images for web use in Photoshop (file size, resolution, color space)?Mar 13, 2025 pm 07:28 PM

Article discusses preparing images for web use in Photoshop, focusing on optimizing file size, resolution, and color space. Main issue is balancing image quality with quick loading times.

How do I use Photoshop's Content-Aware Fill and Content-Aware Move tools effectively?How do I use Photoshop's Content-Aware Fill and Content-Aware Move tools effectively?Mar 13, 2025 pm 07:35 PM

Article discusses using Photoshop's Content-Aware Fill and Move tools effectively, offering tips on selecting source areas, avoiding mistakes, and adjusting settings for optimal results.

How do I use Photoshop's video editing capabilities?How do I use Photoshop's video editing capabilities?Mar 18, 2025 pm 01:37 PM

The article explains how to use Photoshop for video editing, detailing steps to import, edit, and export videos, and highlighting key features like the Timeline panel, video layers, and effects.

How do I calibrate my monitor for accurate color in Photoshop?How do I calibrate my monitor for accurate color in Photoshop?Mar 13, 2025 pm 07:31 PM

Article discusses calibrating monitors for accurate color in Photoshop, tools for calibration, effects of improper calibration, and recalibration frequency. Main issue is ensuring color accuracy.

How do I prepare images for web using Photoshop (optimize file size, resolution)?How do I prepare images for web using Photoshop (optimize file size, resolution)?Mar 18, 2025 pm 01:35 PM

Article discusses optimizing images for web using Photoshop, focusing on file size and resolution. Main issue is balancing quality and load times.

How do I create animated GIFs in Photoshop?How do I create animated GIFs in Photoshop?Mar 18, 2025 pm 01:38 PM

Article discusses creating and optimizing animated GIFs in Photoshop, including adding frames to existing GIFs. Main focus is on balancing quality and file size.

How do I prepare images for print using Photoshop (resolution, color profiles)?How do I prepare images for print using Photoshop (resolution, color profiles)?Mar 18, 2025 pm 01:36 PM

The article guides on preparing images for print in Photoshop, focusing on resolution, color profiles, and sharpness. It argues that 300 PPI and CMYK profiles are essential for quality prints.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft