Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> CSS

CSS ट्रांसफॉर्म और स्केल लागू करते समय इमेज क्वालिटी बनाए रखें

CSS image-rendering प्रॉपर्टी हमें अपनी इमेज को स्केल करने के लिए एक एल्गोरिदम सेट करने में मदद करती है।

सिंटैक्स

CSS image-rendering प्रॉपर्टी का सिंटैक्स निम्नानुसार है:

Selector {    image-rendering: /*value*/ }

उदाहरण 1

निम्न उदाहरण CSS image-rendering प्रॉपर्टी को दर्शाते हैं।

<!DOCTYPE html> <html>    <head>       <style>          img {             height: 200px;             width: 200px;          }          #one {             image-rendering: smooth          }          #two {             image-rendering: pixelated          }          #three {             image-rendering: crisp-edges          }       </style>    </head>    <body>       <img id="one" src="https://images.unsplash.com/photo-1610208309350-766d71494a03?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=128&ixlib=rb-1.2.1&q=80&w=128" />       <img id="two" src="https://images.unsplash.com/photo-1610208309350-766d71494a03?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=128&ixlib=rb-1.2.1&q=80&w=128" />       <img id="three" src="https://images.unsplash.com/photo-1610208309350-766d71494a03?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=128&ixlib=rb-1.2.1&q=80&w=128" />    </body> </html>

इससे निम्न आउटपुट मिलता है:

CSS ट्रांसफॉर्म और स्केल लागू करते समय इमेज क्वालिटी बनाए रखें

उदाहरण 2 (बॉर्डर-रेडियस के साथ)

<!DOCTYPE html> <html>    <head>       <style>          img {             padding: 5%;             border-radius: 40%;             height: 20%;             width: 20%;          }          #one {             image-rendering: pixelated          }          #two {             image-rendering: smooth          }          #three {             image-rendering: crisp-edges          }       </style>    </head>    <body>       <img id="one" src="https://images.unsplash.com/photo-1611090093783-a629a4d9f1a1?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=256&ixlib=rb-1.2.1&q=80&w=256" />       <img id="two" src="https://images.unsplash.com/photo-1611090093783-a629a4d9f1a1?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=256&ixlib=rb-1.2.1&q=80&w=256" />       <img id="three" src="https://images.unsplash.com/photo-1611090093783-a629a4d9f1a1?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=256&ixlib=rb-1.2.1&q=80&w=256" />       <br/>       pixelated, smooth, crisp    </body> </html>

इससे निम्न आउटपुट मिलता है:

CSS ट्रांसफॉर्म और स्केल लागू करते समय इमेज क्वालिटी बनाए रखें

  1. CSS इमेज स्प्राइट का लाभ CSS इमेज स्प्राइट का लाभ

    इमेज स्प्राइट एक ही इमेज फ़ाइल में कई इमेज को जोड़ता है। मुख्य लाभ: HTTP रिक्वेस्ट कम करना (लोड टाइम तेज़), इमेज स्विचिंग स्मूथ होना (होवर/एक्टिव स्टेट के लिए), और कैशिंग दक्षता। उदाहरण <!DOCTYPE html> <html> <head> <style> body { font-family: Segoe UI, Tahoma, Geneva

  1. CSS में 2D ट्रांसफॉर्म फंक्शन्स CSS में 2D ट्रांसफॉर्म फंक्शन्स

    2D ट्रांसफॉर्म फंक्शन्स का उपयोग 2D ट्रांसफॉर्मेशन लागू करने के लिए किया जाता है जो किसी एलिमेंट पर रोटेट, मूव, स्केल और स्क्यू हो सकते हैं।Translate − एलिमेंट को x और y axis के साथ मूव करने के लिए।Scale − x y दिशा में एलिमेंट को रिसाइज़ करने के लिए।Rotate − एलिमेंट को कुछ डिग्री घ

  1. Word, Excel, PowerPoint में सेव करते समय इमेज क्वालिटी बनाए रखें Word, Excel, PowerPoint में सेव करते समय इमेज क्वालिटी बनाए रखें

    दस्तावेज़ तैयार करते समय, उच्च-गुणवत्ता वाली छवियों का होना आवश्यक है। यह न केवल यह सुनिश्चित करता है कि दूसरे इसे स्पष्ट रूप से पढ़ सकें, बल्कि एक छाप भी छोड़ता है। हालांकि, यदि आप ध्यान दें, तो हर बार जब आप एक छवि जोड़ते हैं, तो गुणवत्ता बदल जाती है। यह धुंधली दिखती है, तस्वीर में टेक्स्ट तेज नहीं