How to perfectly use graphic formats such as JPG on the web
JPEG
JEPG was created in 1992 by the Joint Photographic Experts Group and is named after its creator. JPEG is a lossy raster image format, which means that every time a JPEG is compressed and saved, some information
is irreversibly lost.
JPEG takes advantage of flaws in human eye perception - being more sensitive to brightness than color - using a compression algorithm that discards information we're not very good at getting at, and is therefore a "lossy format". The compression setting will determine the size and quality of the final saved file.
Because JPEG is suitable for brightness and color compression, it is used in photos, and other realistic or shaded images (such as paintings and 3D Rendering) with good results. That's why it has been the most popular format for storing pictures for many years. For the same reason, JPEG is not suitable for vector images, such as logos, geometric figures, screenshots, etc.
#Photos, as well as complex or shaded images such as paintings, are good examples of using JPEG.
Compressed JPEG
As a lossy format, the compression rate of a JPEG file is inversely proportional to the final image quality. When saving a JPEG in a tool like Photoshop, you'll see a quality setting from 0 to 100. Photoshop sets some image quality ranges: Low — 10%
Medium — 30% High — 60%
Very high — 80%
Best — 100%
Best 100% (61 KB), Very High 80% (29 KB).
##High 60% (16 KB), Medium 80% (7 KB).
Low 100% (6 KB), Minimum 0% (3 KB).
The Web page recommends using JPEGs between 50% and 60% quality, Because it combines good image quality with small file size. Removing metadata can also reduce JPEG file size.
In Photoshop, compression can be accomplished by selecting "Metadata: None" or "Save for Web (Legacy)" in "Export". Blurring all or part of an image will also produce smaller file sizes.
Please note that since JPEG is a lossy format, even saving the same file at 100% quality will result in a reduction in image quality after multiple times because the compression algorithm is applied again and again on the same image. . But this change may not
Portable Network Graphics is also a raster image format that has been around since 1995. It is different from JPEG in that it is a lossless format and is currently the most common lossless
PNG has a lot of cool features like:
Transparency channel - means each pixel can have a different transparency;8-bit files can use a palette-based color model (also known as indexed color) - meaning the file can be smaller if the number of colors is reduced;is a complex picture, you still need to use PNG, because picture transparency cannot be achieved in JPEG.
- PNG compression is 25% more efficient than GIF
- 2D interlaced — the image is displayed progressively during loading, rather than only when the image is fully loaded. You must use this option with caution as it increases file size.
- Uses of PNG
PNG is great for line drawings, LOGOs, icons and images with less color. Photos and images with complex colors will generate huge files using the PNG format. Another advantage of PNG is that it supports transparent backgrounds. In this case, even if
PNG can be used well for line works, logos and icons.
Compress PNG
Because the compression algorithm in PNG is lossless, you can selectively reduce its colors and thus reduce the image through external tools size.
GIF
Graphics Interchange Format is also a bitmap format and appeared earlier than the other formats mentioned in this article. It was created by Steve Wilhite in 1989 and was the most popular 8-bit image format until PNG was created. GIF has similar characteristics to PNG, but has some disadvantages:
- only supports 256 colors;
- One-dimensional interlacing — the image will Progressive display, but not smooth enough;
- Poor compression performance compared to PNG
- Binary transparency - pixels can only be 100% transparent or 100 % visible;
- Ambiguous pronunciation
##SVG
Scalable vector Graphics (Scalable Vector Graphics) are different from the raster format mentioned earlier. As the name suggests, it is a vector format. This means that it does not store data based on pixels, but instead stores graphics information in the form of recorded coordinates. SVG uses an XML-based semantic tag structure, which is a bit like HTML. Because of the DOM structure, you can get SVG elements by ID and manipulate them. This opens up a lot of possibilities, such as modifying and animating elements or creating responsive graphics using JavaScript and CSS. Like other vector formats, SVG images can be enlarged to any size without losing any detail. Uses of SVG
SVG is widely used in line art, logos, icons, illustrations and data visualization. But it is not suitable for realistic images and complex pictures with many details. In some cases, both SVG and PNG serve the same purpose well. For line art, SVG generally produces smaller file sizes. But this is not inevitable. Depending on how many anchor points the vector image has, it may even generate a larger file than PNG. Where SVG really excels is in data visualization. Since vector animations can be manipulated and created using JavaScript, libraries like D3 offer endless possibilities.
#point. In Sketch, be careful not to use unnecessary folders as they will also be saved as extra tags in the SVG.
Cleaning up unnecessary nodes is one way to reduce the size of SVG.
Element tags are all content contained within an SVG file, including opening and closing tags. Vector editing software such as Adobe Illustrator and Sketch may litter SVG with unnecessary elements and attributes. SVG compressor can be used to remove this redundant information.
The above is the detailed content of How to perfectly use graphic formats such as JPG on the web. For more information, please follow other related articles on the PHP Chinese website!

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor