imagemagick and google page speed

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
eladvider
Posts: 4
Joined: 2017-01-19T02:12:42-07:00
Authentication code: 1151

imagemagick and google page speed

Post by eladvider »

hi,
suddnely the google page speed tool give me a warings about the compression of my resize images :

"Compressing http: ...ganim.jpg could save 8.4KiB (22% reduction)."

im using imagemagick node with the following options:
{srcPath: file,
format: self._setFormat(),
width: self.options.width,
height: self.options.height + prefix,
strip: true,
interlace: "none",
colorspace: "sRGB",
dither: "none",
quality: 0.75

customArgs: [
'-define', 'jpeg:fancy-upsampling=off',
'-filter', 'Triangle',
'-define', 'filter:support=2',
'-dither', 'None',
'-gravity', 'center',
'-unsharp', '0.25x0.25+8+0.065',
'-interlace', 'none',
'-colorspace', 'sRGB',
'-crop', self.options.width + 'x' + self.options.height + '+0+0',
'+repage'
]
}

Does anyone know how to fix it?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: imagemagick and google page speed

Post by snibgo »

Lowering the quality will increase the compression. However, it will also decrease the quality (make the result more different to the original). I don't know if the google page speed tool cares about quality.
snibgo's IM pages: im.snibgo.com
eladvider
Posts: 4
Joined: 2017-01-19T02:12:42-07:00
Authentication code: 1151

Re: imagemagick and google page speed

Post by eladvider »

i already lowered the quality(0.75) and google still yelling at me!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: imagemagick and google page speed

Post by snibgo »

Is this a google web page? Do you have a URL?
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: imagemagick and google page speed

Post by Bonzo »

You do not need to do what Google tell you; it is your choice. If you are only going to reduce one image by 8.4KiB I would have thought it would make very little difference to load time.

I thought jpg quality was in the range of 1-100.
eladvider
Posts: 4
Joined: 2017-01-19T02:12:42-07:00
Authentication code: 1151

Re: imagemagick and google page speed

Post by eladvider »

its about the google page speed score...

the range can be alos 0-1 at least in node imagemagick
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: imagemagick and google page speed

Post by snibgo »

JPEGs can always be compressed, if the goal is merely to accelerate download speeds. Here's a 267x233 image I often use, compressed with "-quality 1", a mere 828 bytes:
Image
The quality is totally horrible. It has an RMSE difference of 7.5% from the original. For ordinary photos like this, I accept an RMSE difference of 1%.
snibgo's IM pages: im.snibgo.com
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: imagemagick and google page speed

Post by dlemstra »

I have also noticed that google page speed has changed. It used to only do lossless compression. What you could try is setting the sampling factor. I think you should do it like this:

Code: Select all

customArgs: [
'-define', 'jpeg:fancy-upsampling=off',
'-define', 'jpeg:sampling-factor=2x2,1x1,1x1',
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
eladvider
Posts: 4
Joined: 2017-01-19T02:12:42-07:00
Authentication code: 1151

Re: imagemagick and google page speed

Post by eladvider »

thanks dlemstra,
it's improve the results but it's not perfect like it was before google changes.

any suggestions?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: imagemagick and google page speed

Post by dlemstra »

You should compare the image with the results from google. There is a download option somewhere on that page. When you compare them with your own images you will see that they are the same.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply