Hi,
I want to validate an incoming Base64 byte array is a valid Image or not. I need to identify any invalid/corrupt image and proceed accordingly. Is there an Aspose functionality to achieve it (in java) ?
@pasa2018, hello,
Here is a function that might be useful:
using System.IO;
using System.Text;
using Aspose.Imaging;
public static bool IsImage(byte[] base64Bytes)
{
var bytes = System.Convert.FromBase64String(Encoding.UTF8.GetString(base64Bytes));
using var ms = new MemoryStream(bytes);
return Image.CanLoad(ms);
}