Verbose with trailing * * used to join lines, # ignored remarks # Look in the public/ directory Requires Linux, ImageMagick and Mogrify One liner: find public/ -not -path "*/static/*" \( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' \) -print0 | xargs -0 -P8 -n2 mogrify -strip -thumbnail '1000>' -format jpg I tack on the format flag to create jpg copies of the images. With mogrify, part of ImageMagick, I resize only the images that are larger than a certain dimension, compress them, and strip the metadata. I use find to target only certain image file formats in certain directories. I just stumbled across this article which may be of interest: Generation of alternatively sized versions and adding srcset attributes to support delivery of responsively sized images.Transformation of the image to a lower quality if the request includes the Save-Data header.Conversion of images to smaller and mobile-friendlier image formats, such as converting GIF, PNG, and JPEG format images to WebP in browsers that support WebP.Removal of data that is invisible or difficult to see, such as certain metadata.Various transformations to improve the delivery efficiency of images via the amp-img tag, such as: Limits maximum image dimensions to prevent browser memory issues and poor responsiveness.\.Caches images and fonts in addition to AMP documents.I use a PHP Framework and have quite a few pages that are Amp compatible which is essential otherwise the pages will not take advantage of the free CDN cache and preferential treatment for mobile SEO. Take a look at the Google supported AmpProject - which is not only for mobiles. They look blurry, some of them a smaller than they should be.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |