Aspect ratio in IOS
Am I correct in my impression that the plugin does not keep the aspect ratio of the resized image in ios. In android the aspect ratio is maintained but not so in ios. If true is there a way we can keep the aspect ration as we resize in ios.
it seems that there are a lot of troubles in the iOS part... If I have some time I would rewrite it maybe in swift if it's possible.
I also have this issue in ios where images after resize don't have the correct aspect ratio. Is there any updates or workaround on this @vazad28 ?
Here, all viceversa, i need at android to change aspect ratio. If i provide height and width then probably best to change aspect ratio to provided sizes, and if provide just width or just height, then keep aspect ratio as in source.
@ourarash a workaround is to create an Image object from original one to check its dimensions and calculate the aspect ratio. Then you can resize setting for example the width and calculating the height to keep the aspect ratio.
let img = new Image();
img.onload = () => {
// Calculate aspect ratio
let aspectRatio = img.width / img.height;
let options = {
uri: uri,
folderName: 'demo',
fileName: 'resized.jpg',
quality: 90,
width: 700,
height: 700/aspectRatio
} as ImageResizerOptions;
this.imageResizer
.resize(options)
.then((filePath) => {
...
});
};
img.src = imageData;
Any news on this? @guillermogfer your solution doesn't work and sometimes app crashes if the image is very large
Good day, any update on this yet for Ionic 3.