Commit 6c85058e authored by Robin Tissot's avatar Robin Tissot
Browse files

Fixes threshold required.

parent 46ffc7d4
......@@ -19,7 +19,7 @@ RUN apt-get update
RUN addgroup --system uwsgi
RUN adduser --system --no-create-home --ingroup uwsgi uwsgi
RUN apt-get install netcat-traditional pngcrush
RUN apt-get install netcat-traditional jpegoptim pngcrush
RUN pip install --upgrade pip
......
......@@ -105,6 +105,7 @@ class DocumentProcessForm(BootstrapFormMixin, forms.Form):
choices=BINARIZER_CHOICES,
initial='kraken')
threshold = forms.FloatField(
required=False, initial=0.5,
validators=[MinValueValidator(0.1), MaxValueValidator(1)],
help_text=_('Increase it for low contrast documents, if the letters are not visible enough.'),
widget=forms.NumberInput(
......
......@@ -539,7 +539,10 @@ class DocumentPart(OrderedModel):
bw_file = os.path.join(os.path.dirname(self.image.file.name), bw_file_name)
with Image.open(self.image.path) as im:
# threshold, zoom, escale, border, perc, range, low, high
res = binarization.nlbin(im, threshold)
if threshold is not None:
res = binarization.nlbin(im, threshold)
else:
res = binarization.nlbin(im)
res.save(bw_file, format=form)
self.bw_image = document_images_path(self, bw_file_name)
......
......@@ -283,6 +283,7 @@ class SegmentationPanel {
box: box,
block: block}, this.ratio);
box_.changed = true; // makes sure it's saved
this.boxes.push(box_);
}
showBlocks() {
......
......@@ -235,6 +235,11 @@ THUMBNAIL_ALIASES = {
'large': {'size': (1110, 0), 'crop': 'scale', 'upscale': False}
}
}
THUMBNAIL_OPTIMIZE_COMMAND = {
# 'png': '/usr/bin/optipng {filename}',
# 'gif': '/usr/bin/optipng {filename}',
'jpeg': '/usr/bin/jpegoptim {filename}'
}
VERSIONING_DEFAULT_SOURCE = 'escriptorium'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment