Hi Team,
I need to compress image if image size is > 1mb… I am able to compress it using code but can one tell me how to get exact size of image first ?
Thanks in Advance.
Regards,
Deepak
Hi Team,
I need to compress image if image size is > 1mb… I am able to compress it using code but can one tell me how to get exact size of image first ?
Thanks in Advance.
Regards,
Deepak
FileInfo
object for the image file.Length
property is greater than 1,048,576.bytes (since 1MB is 1024 x 1024 bytes)Here’s an example of the process:
imageFileInfo
(Type: FileInfo
)New FileInfo("path\to\your\image.jpg")
imageFileInfo.Length > 1048576
What would be the length if image size is 800 kb ?
My image size is 7435 kb and i am getting length 7613242.
Could you please explain ?
You can achieve this using Get File Info Activity and check the Size
(ImageInfo.SizeInKB/1024) > 1
Cheers
Hi
Drag and drop the Get File info activity
In the File Path property of the activity, enter the path to the image file.
Create a variable to store the image size.
var imageSize = GetFileSize(“path/to/your/image.jpg”).Size;
→ Convert the size from bytes to megabytes (MB)
var imageSizeInMB = imageSize / (1024 * 1024);
→ Check if the image size is greater than 1MB
if (imageSizeInMB > 1) {
}
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.