Example WebP Image Permutations
RIP Strategy:
- <source> should generally always output `.webp` images, but instead of this being fixed - it's something specified when requesting the Rip (i.e. in each of the views) - so when required we can still output in a specific format - e.g. if MUST output a .png for a use case.
- Fallback <img> should be whatever format was originally supplied, but if that was a webp, then make it output a png instead - in case they're on e.g. Safari on an old mac (which can't display webp's). We use png's (as opposed to jpeg's) to preserve any transparency.
It's important to know when testing/inspecting:
The active storage image URL seen in the source/inspect IS NOT indicative of the image format which will be supplied if the URL is called. The URL relates to the original file uploaded - e.g. has `.jpg` in its URL if the original was a .jpg - but when that URL is called - it redirects to serve the actual image - which might well be a `.webp`. And vice-versa. So do not be misled by the image URLs seen in the source! You can inspect each - and 'Open in new tab' - and you will get the actual image in the correct format.
Google PageSpeed Insights
If the original supplied is a .jpg - then PageSpeed may still give the 'Use next-gen image formats' warning for it - as we have .jpg on the end of the URL's - even though they're actually provided as a .webp when the original 'service url' (with the .jpg on the end) is requested. So this is a 'false positive'; we are already doing what they're requesting. Practically, if this false warning bothers anyone, all we can do is for originals to be supplied as webp's - so we should now always output (e.g. from Photoshop) as webp where possible.
WebP original image - 1600x900px / 100% quality
RIP should output WebP, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWTA9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--0fcbbc6cc547b97427efa469eee36f6fa14e0123/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_solid_image_1600x900px_webp_100q.webp)
Jpeg/jpg original image - 1600x900px / 100% quality
RIP should output WebP (produced from the jpeg original), with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWTQ9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--609ab97b1a98e4224b25107643738f31af5bde50/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_solid_image_1600x900px_jpg_100q.jpg)
PNG original image - 1600x900px / 100% quality
RIP should output WebP (produced from the png original), with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWTg9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--f5b0eb76092f80840e7ddf7848c37e86ad0c2d9f/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_solid_image_1600x900px_png_100q.png)
PNG original image - 1600x900px / 100% quality / Transparency
RIP should output WebP w/ transparency, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWkE9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--81c85886398e1f00715f01ce08baec46d935b553/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_icons_1600x900px_png_100q.png)
WebP original image - 1600x900px / 100% quality / Transparency
RIP should output WebP w/ transparency, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWkU9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--322a917f552e083e78abcaeac435198395ab4fe1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_icons_1600x900px_webp_100q.webp)
JPG original image - 1600x900px / 100% quality / gradient
RIP should output WebP, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWkk9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--583e901311b163862ae8122ccf9dc1d1d139c697/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_gradient_1600x900px_jpg_100q.jpg)
PNG original image - 1600x900px / 100% quality / gradient
RIP should output WebP, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWk09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3f54e66f915663a1caed276a39dd9fccb454b4f6/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_gradient_1600x900px_png_100q.png)
WebP original image - 1600x900px / 100% quality / gradient
RIP should output WebP, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWlE9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bdf091abef51e377d8edd02975bdf31c22c9ab7e/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_gradient_1600x900px_webp_100q.webp)
JPG original image - 1600x900px / 100% quality / photo
RIP should output WebP, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWlU9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--de706c1c8f0e6fdbe6e0ec947f67e299f2d312b1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_photo_mountain_1600x900px_jpg_100q.jpg)
PNG original image - 1600x900px / 100% quality / photo
RIP should output WebP, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWlk9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--d0f5de63bce67727e4dca0a0f6d625057f0b0ab7/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_photo_mountain_1600x900px_png_100q.png)
WebP original image - 1600x900px / 100% quality / photo
RIP should output WebP, with fallback src being a png file.
![](/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWmM9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--aa9334525cfd018cd443c24623680a1b0536fe66/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9MWm05eWJXRjBPZ2h3Ym1jNkZISmxjMmw2WlY5MGIxOXNhVzFwZEZzSGFRSElNRG9LYzJGMlpYSjdCam9NY1hWaGJHbDBlV2xmIiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--e6460939d4fdc4346cf9a98ab6e681f639fa58f0/test_photo_mountain_1600x900px_webp_100q.webp)