Skip to content Skip to content


How to compress PNG images to speed up your website Come comprimere immagini PNG per accelerare il tuo sito web

LinuxWeb Design & Dev

If you have a blog or a website with a lot of content sometimes the images can take a toll on the load time of the pages. Se avete un blog o un sito web con un sacco di contenuti a volte le immagini possono assumere un pedaggio sul tempo di caricamento delle pagine. There are a number of steps you can take to speed things up. Ci sono una serie di passaggi che è possibile adottare per accelerare le cose. If you analyze the loading of your website you might notice that the images take up a huge part of the load time. Se si analizza il caricamento del tuo sito web, si potrebbe notare che le immagini occupano una parte enorme del tempo di caricamento. Let's take a look at how you can compress your .png images to improve on this figure. Diamo un'occhiata a come si può comprimere il tuo. Immagini PNG per migliorare questa cifra.

We'll use the tool pngcrush for this purpose. pngcrush is a free and open source command line tool that, as the name suggests, compresses PNG images. Useremo lo strumento pngcrush per questo scopo. Pngcrush è un libero e open source riga di comando dello strumento che, come suggerisce il nome, comprime le immagini PNG. Take a look at the projects Date un'occhiata a progetti website sito web for detailed information on how to use it. per informazioni dettagliate su come usarlo. We will cover the basics in this article. Si tratteranno le nozioni di base in questo articolo.

Installation Installazione

Most modern distributions of Linux such as Fedora and Ubuntu have pngcrush available directly in their default repositories. Maggior parte delle distribuzioni di Linux, come Fedora e Ubuntu sono disponibili pngcrush direttamente nel loro repository di default. So, to install it on you Ubuntu computer execute the following command: Quindi, per installare sul tuo computer Ubuntu eseguire il seguente comando:

# sudo apt-get install pngcrush # Sudo apt-get install pngcrush

On Fedora do the following: Su Fedora effettuare le seguenti operazioni:

# yum install pngcrush # Yum install pngcrush

Usage Uso

pngcrush optimizes a PNG graphics file by reducing the size of the files IDAT chunk. pngcrush ottimizza un PNG file di grafica, riducendo la dimensione dei file chunk IDAT. The process is not simple. Il processo non è semplice. The great thing about pngcrush is that the authors of the tool have simplified things for you. La cosa grande circa pngcrush è che gli autori dello strumento hanno semplificato le cose per voi. They ship it with a great option – brute . Che spediscono con una buona opzione - bruta. When you use this option you effectively tell pngcrush to try and use the most suitable method to compress the image at hand. Quando si utilizza questa opzione, è efficace raccontare pngcrush per cercare di utilizzare il metodo più adatto a comprimere l'immagine a portata di mano. There are about 114 different filters that can be used, so this option is mighty useful. Ci sono circa 114 diversi filtri che possono essere utilizzati, quindi questa opzione è utile potente. Here's how you would use it to compress an image: Ecco come si dovrebbe utilizzare per comprimere l'immagine:

# pngcrush -brute -e “.compressed.png” image01.png # Pngcrush-brute-e ". Compressed.png" image01.png

The two options used here are -brute which I just explained, and -e . Le due opzioni usate sono qui-bruta che ho appena spiegato, e-e. The second option tells pngcrush what extension to add the the filenames. La seconda opzione dice pngcrush quale estensione per aggiungere i nomi dei file il. So after the process of crushing is complete the compressed version of the file image01.png will be called image01.compressed.png . Così, dopo il processo di frantumazione è stata completata la versione compressa del file image01.png saranno chiamati image01.compressed.png. you can change the extension if you like. È possibile modificare l'estensione, se volete.

You can also slightly modify the above command to compress several PNG files in a directory. È inoltre possibile modificare leggermente il comando di cui sopra per comprimere i file PNG diversi in una directory. Execute the following command: Eseguire il seguente comando:

# pngcrush -brute -d “/var/www/html/website/images/” *.png # Pngcrush-brute-d "/ var / www / html / website / images /" *. png

The above command uses a new option, -d . Il comando di cui sopra usa una nuova opzione,-d. This option tells pngcrush where to place the compressed image files after the compression is complete. Questa opzione dice pngcrush dove collocare i file compressi immagine dopo la compressione è completa. The above command will compress all the PNG file in the current directory and place them in /var/www/html/website/images/ . Il comando precedente di comprimere tutti i file PNG nella directory corrente e metterle in / var / www / html / website / images /.

I strongly suggest that you read up more about this tool and its options on the projects website. Vi consiglio vivamente di leggere fino informazioni su questo strumento e le sue opzioni sul sito web di progetti. There are a lot of options that might help you speed up the process of compression or do a better job of it. Ci sono un sacco di opzioni che potrebbero aiutare ad accelerare il processo di compressione o fare un lavoro migliore di essa. Put the new images into your website and watch your pages load faster. Mettere le nuove immagini sul tuo sito e guardare le vostre pagine si caricano più velocemente.

Posted in Posted in Linux Linux , , Web Design & Dev Web Design & Dev . .

Get Simple Help tutorials just like this one in your email inbox every day - for free! Ottieni Aiuto tutorial semplice come questo nella tua casella di posta tutti i giorni - gratuitamente! Just enter your email address below: Basta inserire il tuo indirizzo email qui sotto:

You can always opt out of this email subscription at any time. Si può sempre scegliere di questa sottoscrizione email in qualsiasi momento.

0 Responses 0 Responses

Stay in touch with the conversation, subscribe to the Rimani in contatto con la conversazione, la sottoscrizione del RSS feed for comments on this post RSS feed dei commenti a questo post . .



Some HTML is OK Alcuni HTML è OK

or, reply to this post via o, in risposta a questo post attraverso il trackback trackback . .