N
N
Nick Murzin2015-10-12 02:24:27
PHP
Nick Murzin, 2015-10-12 02:24:27

Image optimization library?

Often you have to test the speed of the site on gtmetrix and there one of the points of successful optimization is the optimization of all images. After checking, this service immediately gives links to optimized images, which is often not very convenient - there can be a lot of pictures. I would like to package all this script and run it directly on the server.
Connoisseurs, tell me a library for working with images in PHP?
ps: There is also the kraken.io service - there is also a pretty good optimizer, but the api is paid and you can work for free only through the web face. As I understand it, some kind of js library is used for optimization.
ps: I only googled this option while I'm picking it.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
W
WP Panda, 2015-10-12
@wppanda5

psliwa - good, I use it quite often.
tinypng is a normal option for blogs, with not a lot of photos, for large photos it’s also normal, but you already need a crutch, you need to get a lot of Api keys, and set a counter, after every 500 pictures a month, substitute another
kraken key - not a super option, but there, in the paid version, there is already a bill for the weight of the images, and not the amount of $ 9 for 2 gigs is not much, but the result is not super, often for normal minimization, 2 - 3 runs of the image are required

S
Sergey, 2015-10-12
Protko @Fesor

you googled what you need.
There is also a partially free API at tinyjpg.com: https://tinypng.com/developers
500 images per month, but you need to be careful with png with transparency.

I
Ivan Volkov, 2015-10-12
@oOLokiOo

library - GD... (facepalm)

A
Alexander Taratin, 2015-10-12
@Taraflex

Throw in php libraries.
Run external console optimizers.
For jpegs
PNG

pngquant --force --skip-if-large --speed 1 256 --output <выход> <вход>
PNGZopfli <выход> 10 <выход>

A
AVKor, 2015-10-12
@AVKor

pngcrush, jpegoptim.

D
Dmitry, 2015-10-12
@dimasmagadan

in my opinion, it is better to optimize images on a third-party service
if you are doing on WordPress, connect Jetpack
this plugin has a Photon module - it perfectly knows how to optimize images for free
if you are doing on another engine, try this service
cloudinary.com/invites/lpov9zyyucivvxsnalc5/oxpagw ... (link with ref)
cloudinary.com (and without ref) the
service is paid, but there is a free tariff plan (this is enough for me on the site with 3k uniques / day).
The functionality of the service is excellent - image optimization, can apply filters, crop only the face, cut sizes, cut black margins from videos, CDNs, etc.
There is also a plugin for Wordpress. but you can also connect manually.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question