Hey there! If you need to export specific data from a screenshot, you can crop the image to isolate the required information. After cropping, the Read Text From Image Step should work smoothly. I have used this approach successfully to resolve a similar issue. In the Script Step, I wrote a code to crop a picture using specific coordinates for the starting point, width, and height of the picture. To find this information, you can use Paint:
1. Use the select tool in Paint to choose the area of the picture that you want to crop.
2. Hover the cursor over the top-left corner of the selected area.
The cursor coordinates and picture dimensions will be displayed at the bottom of the Paint application.
Once you have this data, you can use the following code in the Script Step (and adjust the values to fit your picture):
string inputFilePath = (string)VR[“screenshot”]; // variable where is screenshot path
string outputFilePath = (string)VR[“cropedPath”]; // variable where is path for cropped image
int cropX = 108; // X coordinate of the top-left corner of the crop area
int cropY = 158; // Y coordinate of the top-left corner of the crop area
int cropWidth = 61; // Specify the desired width of the crop area
int cropHeight = 20; // Specify the desired height of the crop area
static void CropImage(string inputFilePath, string outputFilePath, int cropX, int cropY, int cropWidth, int cropHeight)
{
using (Bitmap originalBitmap = new Bitmap(inputFilePath))
{
// Ensure the crop dimensions and position are within the original image bounds
if (cropX < 0 || cropY < 0 || cropX + cropWidth > originalBitmap.Width || cropY + cropHeight > originalBitmap.Height)
{
throw new ArgumentException(“Crop dimensions or position exceed original image bounds.”);
}
// Create a new bitmap to hold the cropped image
using (Bitmap croppedBitmap = new Bitmap(cropWidth, cropHeight))
{
// Create a graphics object from the cropped bitmap
using (Graphics g = Graphics.FromImage(croppedBitmap))
{
// Define the rectangle to crop from the original image
Rectangle cropRect = new Rectangle(cropX, cropY, cropWidth, cropHeight);
// Draw the cropped portion of the original image onto the new bitmap
g.DrawImage(originalBitmap, new Rectangle(0, 0, cropWidth, cropHeight), cropRect, GraphicsUnit.Pixel);
}
// Save the cropped bitmap to a file
croppedBitmap.Save(outputFilePath, ImageFormat.Png);
}
}
}
CropImage(inputFilePath, outputFilePath, cropX, cropY, cropWidth, cropHeight);