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);
}
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.