SubtitleEdit/subtitleedit · error · Exception
Image dimensions are larger than 1000x1000
Error message
Image dimensions are larger than 1000x1000
What it means
Thrown by Core.ScanByData when the image's own width or height (as measured from the bytes via Helper.ImageDimensionsFromData) exceeds 1000px. Unlike ScanByBufferAsync which auto-resizes before calling ScanByData, ScanByData expects an already-conformant image and refuses oversized input rather than silently resizing. Lens rejects images larger than 1000x1000, so this is a hard precondition.
Source
Thrown at src/ui/Logic/Ocr/GoogleLens/Core.cs:247
{
if (!Constants.SUPPORTED_MIMES.Contains(mime))
{
throw new Exception("File type not supported");
}
if (originalDimensions == null)
{
throw new Exception("Original dimensions not set");
}
string fileName = $"image.{Constants.MIME_TO_EXT[mime]}";
var dimensions = Helper.ImageDimensionsFromData(uint8);
var width = dimensions.Width;
var height = dimensions.Height;
if (width > 1000 || height > 1000)
{
throw new Exception("Image dimensions are larger than 1000x1000");
}
var file = new ByteArrayContent(uint8);
file.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(mime);
var formdata = new MultipartFormDataContent
{
{ file, "encoded_image", fileName },
{ new StringContent(width.ToString()), "original_width" },
{ new StringContent(height.ToString()), "original_height" },
{ new StringContent($"{width},{height}"), "processed_image_dimensions" }
};
return await FetchAsync(formdata, originalDimensions);
}
private void GenerateCookieHeader(Dictionary<string, string> header)
{
if (HeaderData.Cookies.Count > 0)View on GitHub (pinned to 17a9f07487)
Solutions
- Pre-resize the image to fit within 1000x1000 (maintaining aspect ratio) before ScanByData.
- Use ScanByBufferAsync, which performs the resize automatically.
- Apply Helper.ResizeImageAsync(buffer, 1000, 1000) before invoking ScanByData.
- Reject/guide the user to a smaller image at the UI layer.
Example fix
// before var result = await core.ScanByData(bigBytes, 'image/png', dims); // after if (width > 1000 || height > 1000) bigBytes = await Helper.ResizeImageAsync(bigBytes, 1000, 1000); var result = await core.ScanByData(bigBytes, 'image/png', dims);
Defensive patterns
Strategy: validation
Validate before calling
var (w, h) = Helper.ImageDimensionsFromData(bytes); if (w > 1000 || h > 1000) bytes = await Helper.ResizeImageAsync(bytes, 1000, 1000); var r = await core.ScanByData(bytes, mime, dims);
Type guard
static bool FitsLensLimit(byte[] b) { var (w,h) = Helper.ImageDimensionsFromData(b); return w <= 1000 && h <= 1000; } Try / catch
try { var r = await core.ScanByData(bytes, mime, dims); }
catch (Exception ex) when (ex.Message.Contains("larger than 1000x1000")) { bytes = await Helper.ResizeImageAsync(bytes, 1000, 1000); /* retry */ } Prevention
- Pre-resize images to <= 1000x1000 before ScanByData.
- Use ScanByBufferAsync for automatic resizing.
- Enforce the limit at the UI/picker layer.
- Always pass already-conformant images to ScanByData.
When it happens
Trigger: Calling ScanByData directly with a large image without first downscaling, or calling it after a code path that skips the ScanByBufferAsync resize step.
Common situations: A caller uses ScanByData instead of ScanByBufferAsync and passes a full-resolution screenshot; the resize step was bypassed; an upstream producer did not enforce the 1000px limit.
Related errors
- File type not supported
- Could not determine image dimensions
- Could not decode image
- Could not resize image
- Could not determine original image dimensions.
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/0c4da7a1b0000195.
Report an issue: GitHub.