Skip to content

Brightness/Contrast in Lineart mode #38

@yoder375

Description

@yoder375

I noticed I was having trouble tweaking brightness and contrast when scanning in Lineart mode. Basically anything below 50% brightness would have no effect and 50% and above would result in a blank white image.

Looking at the debug, I realized that it's because the image that the "convert" command is working with is already in black-and-white (aka depth of 1), so it's already a quantized image that has no range to work within to adjust, except to make an all white image.

The solution is to convert the image to grayscale, perform the adjustments, and convert it back to black and white.

Here is what I've done on my server, and I hope it's useful for you...

Starting on line 1307 of current version of index.php, I changed to the following:

                    if($BRIGHT!="0"||$CONTRAST!="0"){
                            if($MODE=='Lineart'){
                                    exe("convert $SCAN -brightness-contrast '$BRIGHT".'x'."$CONTRAST' -depth 16 $SCAN",true);
                                    exe("convert $SCAN -monochrome -depth 1 $SCAN",true);
                            } else {
                                    exe("convert $SCAN -brightness-contrast '$BRIGHT".'x'."$CONTRAST' $SCAN",true);
                            }
                    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions