Google Photos imposes a 100 megapixel limit on uploaded photos. This may sound like a lot, as even the very high-end Sony Alpha a7R III has “only” 48MP sensor, but in reality when you shoot panoramas and stitch them yourself, you can quickly get there, and hit the 100MP limit. When you try to upload your huge panorama to Google Photos, you will get a
A photo or video was skipped
To solve it, you need to resize your image and make it smaller. This can be done automatically using ImageMagick’s convert:
$ convert -resize "100000000@>" panorama-in.jpg panorama-out.jpg
This will resize the
panorama-in.jpg to at most 100MB, and save it as
> makes sure we will only down-size larger photos.
By default under Debian, ImageMagick comes with a very strict `policy.xml` controling the resources it can use. Practically, it means that unless you change those limits, you’ll encounter resource limit errors such as:
convert-im6.q16: width or height exceeds limit `panorama-in.jpg' @ error/cache.c/OpenPixelCache/3802.
To solve it you will need to edit
/etc/ImageMagick-6/policy.xml and increase the limit for memory, width, height and area. For example:
<policy domain="resource" name="memory" value="8GiB"/>
<policy domain="resource" name="width" value="128KB"/>
<policy domain="resource" name="height" value="128KB"/>
<policy domain="resource" name="area" value="8GB"/>
JPEG is a lossy format, and naive rotation results in a loss of quality. JPEG does allow some lossless operations, such as rotation by 90 degrees and flipping, on the basic blocks (MCUs) that compromise the image. It also allows re-arranging those blocks. Using this lossless operation, it is possible to preform a lossless JPEG rotation. To do so, the rotated image mus meet some basic criteria like having it size a multiple of the MCU size (usually 16×16).
Not all programs preform a lossless JPEG rotation, so it is useful to be aware which does. I check a couple of commonly used program to see if they indeed preform lossless rotation. The testing procedure was:
- Start with the original JPEG photo.
- Rotate it once to the right using each program.
- Rotate a copy of the rotated photo back to the right using the same program.
- Compare using ImageMagick (
compare -metric ae) the results.
Gnome’s Image Viewer 3.14.1 is lossless
Digikam (4.4.0) is lossless, however rotating with Digikam’s Image Editor is lossy.
Shotwell (0.20.1) does lossy rotation.
I’ve tried to use ImageMagick to create .ico files for Open Yahtzee, out of PNGs of various sizes. The command as it should have been:
convert openyahtzee16.png openyahtzee32.png openyahtzee64.png openyahtzee.ico
resulted in the alpha channel being reversed. I’ve used ImageMagick 6.4.0, and I didn’t remember this misbehavior happening in the previous versions.
While this annoyed, and was due to no apparent reason, it could be easily solved using the ImageMagick switches to reverse the alpha channel:
So the command that produces a correct .ico file was:
convert openyahtzee16.png openyahtzee32.png openyahtzee64.png -channel Alpha -negate openyahtzee.ico