From: Bernd Herd <codeberg(a)herdsoft.com> If value for bytes_per_line is not reasonable in 1 bit per pixel mode, calculate a new value --- dlls/sane.ds/ds_image.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/sane.ds/ds_image.c b/dlls/sane.ds/ds_image.c index b0288bd2520..f8dd0bf49db 100644 --- a/dlls/sane.ds/ds_image.c +++ b/dlls/sane.ds/ds_image.c @@ -143,6 +143,15 @@ TW_UINT16 SANE_Start(void) return TWRC_FAILURE; } + /* Workaround for some SANE backends that report a wrong value + * for bytes_per_line in LineArt mode */ + if (activeDS.frame_params.depth == 1 && + activeDS.frame_params.format == FMT_GRAY && + activeDS.frame_params.bytes_per_line == activeDS.frame_params.pixels_per_line) + { + activeDS.frame_params.bytes_per_line = (activeDS.frame_params.pixels_per_line + 7) / 8; + } + if (activeDS.progressWnd) { WCHAR szLocaleBuffer[4]; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9673