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
Photoshop's Key Features: A Deep DivePhotoshop's Key Features: A Deep DiveApr 19, 2025 am 12:08 AM

Key features of Photoshop include layers and masks, adjustment tools, filters and effects. 1. Layers and masks allow independent editing of image parts. 2. Adjust tools such as brightness/contrast can modify image tone and brightness. 3. Filters and effects can quickly add visual effects. Mastering these features can help creative professionals achieve their creative vision.

Photoshop and Digital Art: Painting, Illustration, and CompositingPhotoshop and Digital Art: Painting, Illustration, and CompositingApr 18, 2025 am 12:01 AM

Photoshop's applications in digital art include painting, illustration and image synthesis. 1) Painting: Using brushes, pencils and mixing tools, the artist can create realistic effects. 2) Illustration: With vector and shape tools, artists can accurately draw complex graphics and add effects. 3) Synthesis: Using mask and layer blending mode, artists can seamlessly blend different image elements.

Advanced Photoshop Tutorial: Master Retouching & CompositingAdvanced Photoshop Tutorial: Master Retouching & CompositingApr 17, 2025 am 12:10 AM

Photoshop's advanced photo editing and synthesis technologies include: 1. Use layers, masks and adjustment layers for basic operations; 2. Use image pixel values ​​to achieve photo editing effects; 3. Use multiple layers and masks for complex synthesis; 4. Use "liquefaction" tools to adjust facial features; 5. Use "frequency separation" technology to perform delicate photo editing, these technologies can improve image processing level and achieve professional-level effects.

Using Photoshop for Graphic Design: Branding and MoreUsing Photoshop for Graphic Design: Branding and MoreApr 16, 2025 am 12:02 AM

The steps to using Photoshop for brand design include: 1. Use the Pen tool to draw basic shapes, 2. Add shadows and highlights through layer styles, 3. Adjust colors and details, 4. Use smart objects and actions to automatically generate different versions of the design. Photoshop helps designers create and optimize brand elements with the flexibility of layers and masks, ensuring consistency and professionalism of designs, from simple logos to complex branding guides.

Photoshop's Subscription Model: What You Get for Your MoneyPhotoshop's Subscription Model: What You Get for Your MoneyApr 15, 2025 am 12:17 AM

Photoshop's subscription model is worth buying. 1) Users can access the latest version and use across devices at any time. 2) The subscription fee is low, and continuous updates and technical support are provided. 3) Advanced functions such as neural filters can be used for complex image processing. Despite the high long-term costs, its convenience and feature updates are valuable to professional users.

Photoshop: Investigating Free Trials and Discount OptionsPhotoshop: Investigating Free Trials and Discount OptionsApr 14, 2025 am 12:06 AM

You can get the access to Photoshop in the most economical way: 1. Experience the software features with a 7-day free trial; 2. Find student or teacher discounts, as well as seasonal promotions; 3. Use coupons on third-party websites; 4. Subscribe to Adobe CreativeCloud's monthly or annual plan.

Photoshop for Designers: Creating Visual ConceptsPhotoshop for Designers: Creating Visual ConceptsApr 13, 2025 am 12:09 AM

Creating visual concepts in Photoshop can be achieved through the following steps: 1. Create a new document, 2. Add a background layer, 3. Use the brush tool to draw basic shapes, 4. Adjust colors and brightness, 5. Add text and graphics, 6. Use masks for local editing, 7. Apply filter effects, these steps help designers build a complete visual work from scratch.

Is Photoshop Free? Understanding Subscription PlansIs Photoshop Free? Understanding Subscription PlansApr 12, 2025 am 12:11 AM

Photoshop is not free, but there are several ways to use it at low cost or free: 1. The free trial period is 7 days, and you can experience all functions during this period; 2. Student and teacher discounts can cut costs by half, and school proof is required; 3. The CreativeCloud package is suitable for professional users and includes a variety of Adobe tools; 4. PhotoshopElements and Lightroom are low-cost alternatives, with fewer functions but lower prices.

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 Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.