responsive image and srcset with Imager
It looks like the sizes attribute needs to be tweaked. Absolute image sizes need to be specified in px units, not w. 

&lt;img src="{{ craft.imager.base64Pixel(16, 9) }}" 
     sizes="(min-width:641px) 400px, 100vw" 
     srcset="{{ craft.imager.srcset(transformedImages) }}" 
     class="{{ imageClass }}"&gt;


The way the browser reads sizes is left to right and picks the first match. So the assumption would be that if the viewport width isn't greater or equal to 641px, then it must be smaller than 641px. So there's no need for (max-width: 640px). The last value is the default size. 

Alternately, this could be expressed by declaring the smallest viewport size to largest like this:

sizes="(max-width:640px) 100vw, 400px"


Also, instead of saying "when the viewport is smaller than 640px, use the 640px image", e.g. (max-width: 640px) 640px, what you probably want is 100vw. I'm assuming the image doesn't always stay 640px even when the screen gets smaller. If your design is responsive, the image will scale down with the screen width. 

Using 100vw means that when your viewport is 400px wide or smaller, the browser can now choose to download the 400px wide image version. Or if the viewport is 640px wide, the 640px wide image is a better match.

Here's an example on Codepen: https://codepen.io/alexroper/pen/VxGgLj

Another possible reason you're not seeing the 400px size is if you're using a hi-dpi, "Retina" display or similar 4k monitor. The browser picks the best image to display from the available ones in srcset. If you specified the target image size as 400px (CSS reference pixels), but you're display is 2x "Retina" display, the browser will favor using the higher resolution image. The high pixel density of a 2x display can fit 800 pixels in a 400-pixel space. 640px isn't as large as 800px, but it's better than 400px so the browser would choose that image.

So even tho an iPhone 5 has a screen size of 320 × 568 in css reference pixels, the physical pixels are double that (640×1136). Safari will prefer to download the higher res 640px image over the 400px one in the img tag example above.