[conspire] image rotation/display ... technology ... ugh (& EXIF - or when it goes wrong)
Deirdre Saoirse Moen
deirdre at deirdre.net
Sat Dec 12 15:24:21 PST 2020
> On Dec 12, 2020, at 14:08, Michael Paoli <Michael.Paoli at cal.berkeley.edu> wrote:
>
> Repeat the process ... all looks fine using display,
> then web browsers, ... crud, looks like same again - maybe the
> browser is being "too smart", rotating based on aspect ratio or something
> like that? I dunno, try another browser ... same ...
> try browsers with file: URLs instead of https or http ... same,
> what the heck.
As you figured out, this is stored in EXIF data. I’ve had to correct rotations for images more than once.
> Ah ha!
> The camera was pointed about straight down when the pictures were taken.
> And the camera was "smart enough" <cough, cough>, to then decide,
> probably on the camera's orientation, and not at all the image data (at
> least apparently), how the images ought be rotated when displayed,
> and so noted in the EXIF orientation metadata,
> to correct for the camera's orientation.
To be fair, that’s a good assumption *most* of the time.
My fun for the day is to pick a background color for a screen (that the image is then placed on top of) out of sampled colors from the image so that it picks a dark color that’s a distinct color (and not just a grey).
While RGB sucks for a lot of color space specification (try sorting colors in rainbow hue using only RGB without going crazy), for this, it’s pretty good for the first approximation:
1. Get the average color between the three R, G, B values. Lower = darker.
2. Take the least squares of each color, and the highest number is the least grey.
So, 3x3 sample at several points on the image, and then pick the darkest (up to a point) least grey one. A Simple Matter of Programming™.
Deirdre
More information about the conspire
mailing list