JavaScript Image Optimiser (JSIO)

So, I’ve embarked on a new mini project. It is kind of inspired by image sprites.

Image sprites are a great idea, but come with a whole bunch of issues that make them a bit of a pain to work with.

Firstly, most of the time you have to use markup to create an element in html to “hold” the image you wanted to display from your sprite. This is because if you actually set a sprite as the background image for a large html element you’re likely to see other images in the sprite as well. Because of this, you actually lose useful functionality that CSS gives you, like the ability to position, repeat and scale an image. Also, the markup you’ve created to hold the image exists for style purposes, which is bad.

Secondly, sprites can be a massive ball ache to maintain. If you’ve closely packed your images in a sprite for maximum efficiency and then one of your images needs to change size, you’re either going to have to move ALL images surrounding the image you have to update (and obviously then change all background-position properties for the images you’ve moved) or leave a space and put the updated image in a new position in your sprite.

How do you know which images in a sprite are used and which ones are dead? Since your images are referenced by coordinates, this sort of clean up becomes a nightmare and is actually a bit lot of a nightmare to create image sprites in the first place.

The goals of the project are to

  1. Reduce the number of http requests (and their associated header traffic) to the server and hence reduce the time it takes to load all images on a website and bandwidth footprint the site requires
  2. Create a solution that’ll alleviate some of the problems surrounding the creation and use of image sprites
  3. Do something cool

The JSIO project website has a pretty good explanation of how it works so I won’t bore you with the details here. However, as a brief overview, it packages all your image data in data uri format and you reference particular images by their filename rather than their coordinates.

The site actually uses the HTML5 file api to generate your resources file for you, which makes creating and maintaining your JSIO “sprite” really really easy.

I read *somewhere* that data uri encoded images can be up to 1/3 larger than corresponding image files, however with gzip encoding they can be only 0-3% larger (or less). My thesis is that for a site with many small images, JSIO could be more efficient and easier to maintain than having separate files or even an image sprite.

…I’m yet to prove or disprove this and I’ll be conducting some tests whose results I’ll post up here (even if they do prove JSIO to be useless).

Disclaimer: This is the first ever ALPHA release of JSIO – it works on the latest Firefox and Chrome but I haven’t even checked it in IE yet. It probably won’t work in IE yet. Also, the website needs some work for optimal display on mobile devices.

9,393 thoughts on “JavaScript Image Optimiser (JSIO)

  1. The discussion here feels very nicely structured and easy to follow because the ideas are introduced smoothly and the overall tone remains balanced welcoming and approachable for readers who want to participate in the conversation. dogs fuck porno

  2. Looking for crypto swap widget? Visit orgtrade.org – OrgTrade helps website owners add a crypto exchange widget to their pages and convert cryptocurrency-related traffic into swap activity. Instead of sending visitors through a simple outbound link, your site can feature an integrated exchange tool where users can select a pair, enter an amount, and initiate a crypto conversion.

  3. Ищете дешевые авиабилеты в США? Посетите сайт https://usaflights24.com/ и вы найдете лучшие предложения на авиабилеты. С помощью нашего мощного поисковика вы за несколько секунд сравните тарифы сотен авиакомпаний и тревел-платформ и мгновенно подберёте самый бюджетный вариант. И никаких скрытых платежей: цена, которую вы видите, — это цена, которую вы платите, никаких сюрпризов при оформлении заказа.

  4. Велакаст — современный препарат для лечения хронического гепатита С, который помогает тысячам пациентов вернуться к полноценной жизни. Официальный ресурс https://velkast.space/ предоставляет исчерпывающую информацию о лекарстве, его составе и механизме действия, а также содержит реальные отзывы пациентов и подробную инструкцию на русском языке. На сайте доступна проверка подлинности препарата, консультация квалифицированных специалистов и организация доставки по всей России с соблюдением необходимых стандартов качества и безопасности.

  5. Велакаст — это современный препарат для лечения гепатита С, который завоевал доверие пациентов благодаря высокой эффективности и удобству применения. Комбинация софосбувира и велпатасвира позволяет успешно бороться с различными генотипами вируса, обеспечивая излечение в большинстве случаев. На информационном портале https://velakast.online/ вы найдете подробную информацию о препарате, принципах его действия и особенностях терапии. Здесь собраны реальные отзывы пациентов, прошедших лечение, а также важные рекомендации по применению. Перед началом терапии обязательно проконсультируйтесь с врачом для подбора оптимальной схемы лечения.

  6. https://t.me/hudushin_seo Как зарабатывать больше в фитнес-бизнесе без лишних затрат. Реальные кейсы: CRM, автоматизация продаж, ИИ-инструменты, управление командой. Делюсь тем, что работает в Zaruba Fitness

  7. Увлажнитель воздуха — незаменимый помощник для здоровья и комфорта в вашем доме, особенно в отопительный сезон. Сухой воздух провоцирует проблемы с кожей, дыханием и сном, а правильный прибор решает эти проблемы. На странице https://www.gtrksmol.ru/5-prichin-kupit-uvlazhnitel-i-eshhyo-5-chtoby-vybrat-ego-pravilno/ вы найдете пять веских причин для покупки и пять советов по выбору идеальной модели для вашей квартиры.

  8. Сервис ПроМастер решает бытовые проблемы в режиме 24/7 по всей России — от протечки крана до сложного ремонта техники. Платформа https://master-na-dom.online/ объединяет проверенных специалистов более чем в 170 городах, гарантируя выезд мастера за 30 минут без предоплаты. Удобная система заявок, прозрачное ценообразование и годовая гарантия на все виды работ делают сервис надёжным помощником в решении домашних задач любой сложности.

  9. Ищете купить geely? Заходите на официальный сайт дилера geely-kuntsevo.ru – здесь вы найдёте полный модельный ряд и актуальные автомобили в наличии. Узнайте технические характеристики автомобилей, их комплектациями, ценами, а также все о специальных предложениях и программах для физических и юридических лиц. Приобретите Geely в Москве по привлекательной цене именно у нас. Ваш будущий автомобиль получит полную гарантию и квалифицированное техническое обслуживание!

  10. оборудование для фасовки кофе Наше оборудование для фасовки кофе включает в себя как ручные, так и полностью автоматизированные линии. Подберите оптимальный вариант для масштабов вашего производства.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>