[GTALUG] Help need in bash

Seneca Cunningham tentra at gmail.com
Fri Jun 1 13:13:43 EDT 2018


> On Jun 1, 2018, at 10:34, D. Hugh Redelmeier via talk <talk at gtalug.org> wrote:
> 
> | From: Stewart Russell via talk <talk at gtalug.org>
> 
> | Using convert is okay, but you won't end up with the smallest JPEGs that
> | way.
> 
> What do you recommend?  (Lightning talk?)

I would recommend being aware of the “-quality” flag for convert (it tends to default to 92).  Valid values for it range between 1 (smallest file, worst artefacts) and 100 (largest file, best quality).  Give it a try with different setting, pick the one that is the best compromise.  Use some files that JPEG is both bad and good at compressing in your test set.

Another flag that is of potential interest is “-strip”, which removes all non-required metadata.  It’s a bit of a double-edged sword, as part of that removed data is the ICC profile.  The embedded colour profile is what gives the viewing application a reference for the colours.  No reference means the file may be rendered with the colours slightly off.  Now if this is purely for web use, we’re at the point that sRGB is assumed.  If you first ensure that your source data is correct in sRGB, you can strip off the profile and web browsers will display it correctly.  In smaller, thumbnail-sized images, the metadata can exceed the size of the image data.

Also removed by “-strip”, would be the “non-destructive” edits performed by some applications.  These “edits” are a list of modifications to the image shoved into the XMP metadata, and in bad cases, I’ve seen that list of XML exceed 5MB and bring ExifTool to a screeching halt.  I don’t feel as bad about removing that cruft.  If you use non-destructive editing tools, be sure to save a flat copy somewhere and run your outside tools against the copy.

Seneca


More information about the talk mailing list