You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

2.4 KiB

Anamorphic

A desqueezed anamorphic image

Anamorphic resizes images taken with an anamorphic lens that require horizontal 'desqueezing' to return the image to an accurate aspect ratio.

The default value is 1.33 which works with the Moment Anamorphic lens. With a Pixel 5 this will turn a photo taken with the 'Wide crop' 16:9 ratio setting into a 2.40:1 widescreen image, a photo taken with the standard full-sensor 4:3 ratio will become 1.77:1.

Source Result
A squeezed anamorphic image The same image scaled horzontally by 1.33

Android Image Resizing

All Anamorphic does is resize an image by a horizontal scaling factor. On Android this seemingly simple operation is actually extremely difficult to do safely.

Anamorphic includes two resizing methods which you can toggle in the settings screen if you run into memory issues:

  • Using standard Android APIs: Bitmap.createScaledBitmap(source, targetWidth, targetHeight, true) - this is the simplest method and works well on a Pixel 5. It may not work on devices with less memory, or devices which take higher resolution images - or both.
  • Using Toolkit: a standalone replacement library for Renderscript. Renderscript is being deprecated in favour of Vulkan from Android 12 onwards. To ease the transition Google have created a standalone native library you can include with your projects that offers the same operations that you'd get previously with Renderscript's intrinsic filters. These have been written with the NDK and are faster than the previous Renderscript implementations and exposed with a simple API via the Toolkit object.

Other image resizing options not included with Anamorphic:

  • Vulkan: extremely fast and makes full use of the GPU, but it does require you to code using the NDK/JNI
  • Image loading libraries such as Glide, Picasso etc etc - these are usually used as a quick and easy way of loading remote images into an ImageView, especially in e-commerce apps. Most, if not all, also have more granular control and will allow you to resize images.