mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-19 13:48:58 +00:00
Fixed resize compression format
This commit is contained in:
parent
4b09664a5a
commit
b867e38530
1 changed files with 10 additions and 2 deletions
|
@ -5212,10 +5212,18 @@ public class FragmentCompose extends FragmentBase {
|
|||
resized = rotated;
|
||||
}
|
||||
|
||||
Bitmap.CompressFormat format;
|
||||
if ("image/jpeg".equals(attachment.type))
|
||||
format = Bitmap.CompressFormat.JPEG;
|
||||
else if ("image/png".equals(attachment.type))
|
||||
format = Bitmap.CompressFormat.PNG;
|
||||
else if ("image/webp".equals(attachment.type))
|
||||
format = Bitmap.CompressFormat.WEBP;
|
||||
else
|
||||
throw new IllegalArgumentException("Invalid format type=" + attachment.type);
|
||||
|
||||
File tmp = new File(file.getAbsolutePath() + ".tmp");
|
||||
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(tmp))) {
|
||||
Bitmap.CompressFormat format = ("image/jpeg".equals(attachment.type)
|
||||
? Bitmap.CompressFormat.JPEG : Bitmap.CompressFormat.PNG);
|
||||
if (!resized.compress(format, REDUCED_IMAGE_QUALITY, out))
|
||||
throw new IOException("compress");
|
||||
} catch (Throwable ex) {
|
||||
|
|
Loading…
Reference in a new issue