danmichaelo / croptool

Tool for cropping images at Wikimedia Commons and other Wikimedia wikis
https://croptool.toolforge.org/
Other
46 stars 23 forks source link

Image filters #121

Open alexbrollo opened 5 years ago

alexbrollo commented 5 years ago

Dealing with CropTool working on book illustrations (cropped from djvu/pdf image files), it will be great to have some filter for cropped image; rotation runs already and it's excellent. The most useful filters could be a gray scale converter and a normalizer (t.i. to get a gray image with a white background). Sometimes simply a binarized BW image would be the best. By now, I upload illustrations by CropTool into Commons as they are, then I download them from Commons and I re-upload them as new versions after needed manipulation by XnView.

Please think about if you can!

danmichaelo commented 5 years ago

Do you have a before and after example? I understand the need for postprocessing images extracted from books, but I'm not completely sure if I understand what you mean by "normalizer".

In general I'm trying to keep the interface simple and avoid feature creep to keep the tool maintainable, but I‘m open to ideas. If something is simple to add, I might do it.

alexbrollo commented 5 years ago

This is a simple example: https://commons.wikimedia.org/wiki/File:Iorga_-_L%27arte_popolare_in_romania,_1930_(page_1_crop).jpg

As you see, there's a color to gray scale conversion and a "normalization", manipulating the histogram so that lighter gray background has been converted to white, and darker areas has been converted in black. There are filters that do the job, but I don't know what filter is simplest to use into ToolLab environment (I presume some ImageMagick, routine bt I'm not so experienced about them, I commonly use XnView GUI to postprocess images).

Alex

Il giorno gio 29 nov 2018 alle ore 19:37 Dan Michael O. Heggø < notifications@github.com> ha scritto:

Do you have before and after example? I understand the need for postprocessing images extracted from books, but I'm not completely sure if I understand what you mean by "normalizer".

In general I'm trying to keep the interface and simple and avoiding feature creep, but I‘m open to ideas. If something is simple to add, I might do it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/danmichaelo/croptool/issues/121#issuecomment-442944476, or mute the thread https://github.com/notifications/unsubscribe-auth/AElgkYrM-KTwVZaW837F4bnaQhbY9atAks5u0ClXgaJpZM4YvZdl .

belett commented 4 months ago

Hi,

This would indeed be a very good idea!

ImageMagick has a command "convert to grayscale" (with a lot of parameters, some may or may not be useful).

mquinson commented 4 months ago

I never used Imagick myself and did not write one line of code in PHP since years, but I think that the solution could be somewhere around these pages: https://stackoverflow.com/questions/13547466/php-imagick-convert-image-to-greyscale-very-bad-result https://www.php.net/manual/en/imagick.setimagetype.php

Maybe we need a new check box in croptool saying "convert to grayscale", which if checked, could apply $im = $im->fxImage('intensity'); in function crop of Image.php in a way that is similar to the first answer in the stackoverflow link above.

Sorry I cannot provide a patch myself, I'm completely rusted in PHP.