3 ms·
It takes a couple of hours to write code to handle exif rotations.
by dbdjfjrjvebd 7y ago
It takes a couple of hours to write code to handle exif rotations.
- matheusmoreira 7y agoSo why can't browsers handle it? Now that I think about it, browser image viewers are pretty basic...
- byuu 7y agoI was curious too and looked into it. Someone originally thought it would be a good idea to ignore EXIF data, and by the time someone else cared enough to address it, they were worried about breaking sites that had bad rotation EXIF data if browsers suddenly started honoring it. Mozilla tried to add image-orientation: from-image CSS for this purpose, so sites could say "no actually the EXIF data really is good", but then no other browser vendor followed along. So as usual, everything in computer science is just terrible for the sake of legacy compatibility with the first implementations ever made.
- SaladFork 7y agoRelevant Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=56845 https://bugs.chromium.org/p/chromium/issues/detail?id=56845 It works fine when you open the image directly, but it will not apply EXIF corrects for inline images (<img> tag). There are JS libraries that load the image as file data to read the EXIF data and apply the correct rotation, but those fail in some cases (HTTPS trying to load data for an HTTP-linked image, for example).
- deleted 7y ago[deleted]
- _visgean 7y agoin python I use pywand: def generate_with_wand(self, wand_img: WandImage): # create stripped down version of our image: wand_img.strip() wand_img.auto_orient() wand_img.compression_quality = 90 thumb = wand_img.clone() thumb.transform(resize=self.size) thumb.save(filename=str(self.get_output_path()))
- dbdjfjrjvebd 7y agoExactly! I was including making test case images and writing tests.