Skip to content

Resize also rotate image #14

@t30n3

Description

@t30n3

Hello,
I'm using this plugin to resize images loaded via picker on a XF app.
In Android, when I pick an image and execute the following code the image is correctly resized but it is also rotated.

using (IEditableImage image = await CrossImageEdit.Current.CreateImageAsync(stream))
 {
    byte[] byteArray = await Task.Run(() => image.Resize(700).ToPng());

    using (Stream outStream = File.OpenWrite(newFileName))
    {
        outStream.Write(byteArray, 0, byteArray.Length);
        outStream.Flush();
        outStream.Close();
     }
}

I also tried the following code but the result is the same:

byte[] byteArray;

if (image.Width >= image.Height)
    byteArray = await Task.Run(() => image.Resize(700, 0).ToPng());
else
    byteArray = await Task.Run(() => image.Resize(0, 700).ToPng());

using (Stream outStream = File.OpenWrite(newFileName))
{
    outStream.Write(byteArray, 0, byteArray.Length);
    outStream.Flush();
    outStream.Close();
}

Thanks in advance,
Matteo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions