How does WordPress or plugin determine PPI resolution of uploaded image?
-
I’m a UX designer and plan to built my portfolio website with WordPress.
Most of my computer generated image assets (wireframes, mockups, pixel perfect screen designs, screenshots of implemented software) exist as lossless image files (as PNGs mostly):
– Their resolution differs: Some are @1x files, some @2x or @3x or @4x.
– Some of them have the PPI (pixels per inch) embedded in the PNG header (72, 144, 216, 288). Others not.I read that Perfect Image doesn’t support lossless image formats at all, nevertheless I post here, in the hopes that the proper knowhow concerning responsive images in WordPress exists here, and someone may know/recommend how to proceed in my particular application of it.
For photos the issue of responsive images is far easier. No issues. I get how it works.
But for screen designs one prefers them to be presented at the correct resolution or if scaled then only at full multiples (x1 x1.25 x1.5 x2 etc) in order to avoid blurry pixel interpolations as good as possible. I’m aware that I will have to take care in my media queries and the CSS in the template / page builder that the jumps occur only in that steps (x1 x1.25 x1.5 x2 etc), and not in continuous scaling (x 1, x 1.023, x 1.357, x 1.54 , …) which forces the web browser to use more blurry interpolation.
But first I must make sure that WordPress correctly knows which image source file corresponds to what resolution. And that the other resolutions get auto-generated. And that the srcset it creates from this is correct. Or if auto-generation of lossless images is not possible at all and I have to do that manually, how I upload and inform WordPress about those other resolution versions, and that if I place such an image in a page-builder (plan to use Oxygen Builder) that this builder sees this as a normal WordPress image object and all the responsive image magic happens behind the scene.
Upcoming process:
I’m in the process of “normalizing” the different image assets prior uploading/embedding them to WordPress:
– Converting all to the sRGB color space.
– Running all through PNG optimization (ImageOptim which uses OxiPNG, AdvPNG, PNGCrush).
– Last: Specifying PPI information where missing: Into the PNG file header or also into the filename if required. I would do that as WordPress requires them to be.My questions:
1) How does WordPress (and/or Perfect Image or other similar plugins) determine whether an uploaded image is already @2x or @3x?
a) Does it expect a signifier in the filename?
b) Does it inspect the PPI info in the PNG metadata header?
b2) If it does so, does it rename the file accordingly?
b3) What if PPI in the header and PPI in a filename fragment contradict? Which one takes precedence?2) WordPress / Perfect Image / other plugin should then only create missing lower resolution ones. No upscaling ofc.
a) Can it perform the auto-generation in a RELATIVE manner?
By relative I mean if it detects the upload to be a @3x, it only creates a @2x @1x of that same version. So only a resolution-reduction at full multiples. Not scaling to some fixed pixel-width tiers.
- The topic ‘How does WordPress or plugin determine PPI resolution of uploaded image?’ is closed to new replies.