I have been seeking something (Linux command line batch style) that cleans the edges of .jpg scans. Something that just replaces a few millimeters on the left and right with white.
I am sure this can be done with imagemagick somehow, I just haven't figured it out yet.
Edge cleaning?
Moderator: peterZ
Re: Edge cleaning?
The imagemagick forum is probably a good place to seek help on that, I remember a while back someone with a different need received excellent support...steve54301 wrote: ↑31 Aug 2019, 10:15 I have been seeking something (Linux command line batch style) that cleans the edges of .jpg scans. Something that just replaces a few millimeters on the left and right with white.
I am sure this can be done with imagemagick somehow, I just haven't figured it out yet.
The XnView command line utility NConvert is another possibility, providing crop and canvas resize operations for example, but I have only developed Windows scripts, although the basic code should be the same; if you develop a Linux script I would be interested to see it!
Edit:
Unless you particularly want a command line solution, it should be easy to do what you want directly today using the excellent cross-platform XnConvert GUI batch conversion software. Without testing it, I think that two canvas resize actions will do what you need:
1 A canvas resize to, for example 98% image width about the center, to clean the edges;
2 A canvas resize to 102% image width about the center, with the background colour for the canvas added set to white, to restore the original width.
Re: Edge cleaning?
Not a Linux utility but BookCrop https://github.com/nod5/BookCrop has a scrub mode where you draw a rectangle over the overlay of all images in a batch to make that area white in all images in the batch. It uses GraphicsMagick (similar to ImageMagick) under the hood.steve54301 wrote: ↑31 Aug 2019, 10:15 I have been seeking something (Linux command line batch style) that cleans the edges of .jpg scans. Something that just replaces a few millimeters on the left and right with white.
Here's an example of the type of command line syntax you'd use.
Code: Select all
gm.exe convert "C:\dir\image.tif" -fill white -draw "rectangle <X0>,<Y0> <X1>,<Y2>" "C:\dir\image_output.tif"
References
http://www.graphicsmagick.org/convert.html
http://www.graphicsmagick.org/GraphicsM ... tails-draw