Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

BookCrop - batch crop right/left page images

General discussion about software packages and releases, new software you've found, and threads by programmers and script writers.
dtic
Posts: 457
Joined: 06 Mar 2010, 18:03

Re: BookCrop - batch crop right/left page images

Post by dtic » 21 Nov 2014, 10:26

Weird that it worked several times but then stopped working. Have you doublechecked by restarting the application and perhaps testing on some other folder of images?

Was it the basic crop feature that you used when it stopped working? Or the new R L feature or the rotate feature?

GraphicsMagick: Maybe you accidentally downloaded the source and not the binary (exe installer)? The latest binary is found here
http://sourceforge.net/projects/graphic ... es/1.3.20/
Pick the Q8 version and then 32 or 64 bit depending on computer.

reproman
Posts: 18
Joined: 03 Apr 2014, 21:20
E-book readers owned: 8 kindles
Number of books owned: 3000
Country: us

Re: BookCrop - batch crop right/left page images

Post by reproman » 28 Nov 2014, 00:15

Working fine now as long as I don't have more than about 400 pages per batch to crop.
Really increases accuracy of the select step in ST when cropped before using ST.
Thanks for the work of the programmer and many thanks to for Tulon for Scan Tailor.

dtic
Posts: 457
Joined: 06 Mar 2010, 18:03

Re: BookCrop - batch crop right/left page images

Post by dtic » 28 Nov 2014, 03:39

With a lot of images (especially large ones) maybe GraphicsMagick (which does the processing behind the scenes) freezes in some scenarios, I haven't really tested that. But an easy workaround is to crop a project in two or more batches then.

If your projects are mostly text then you may want to test using BookCrop followed by QuickPicZone, which can first process all the croppped whole pages to text (no content selection) and then secondly go back do picture zones only on pages with illustrations/images.

hatatat
Posts: 12
Joined: 01 Apr 2012, 06:53
Number of books owned: 0
Country: Germany

Re: BookCrop - batch crop right/left page images

Post by hatatat » 08 Apr 2016, 16:16

Hi,

today I tried to install BookCrop including the applications GraphicsMagick and libjpeg.

Unfortunately, it does not work. Observation: after installing everything, executing BookCrop and droping a folder to the window:

1. a message "creating overlay" appears for some seconds
2. a vertical line appears that divides my screen. Nothing else can be done apart from closing the application

Could somebody of you perhaps supply me with your (working) version of
a) jpegtran.exe
b) libjpeg-62.dll

(and perhaps also the installation file of GraphicsMagick?)

Thanks in advance!

PS:
I suppose that libjpeg-turbo is the "culprit" as it got an update for all existing releases on 2016-03-14.

dtic
Posts: 457
Joined: 06 Mar 2010, 18:03

Re: BookCrop - batch crop right/left page images

Post by dtic » 09 Apr 2016, 05:07

The latest released version of BookCrop was tested together with these files. Try them and see if it works.

https://sourceforge.net/projects/graphi ... es/1.3.20/
GraphicsMagick-1.3.20-Q8-win64-dll.exe

https://sourceforge.net/projects/libjpe ... les/1.3.0/
jpegtran.exe from bin folder in unzipped libjpeg-turbo-1.3.0-gcc64.exe

Edit: I just now also tried with the latest versions of GraphicsMagick ( GraphicsMagick-1.3.23-Q8-win64-dll.exe
) and the files from latest libjpeg-turbo ( libjpeg-turbo-1.4.90-gcc.exe ) and BookCrop still works. (There is no significant difference in processing speed compared to using the older versions linked above.)

So something else might be causing the error on your system.
2. a vertical line appears that divides my screen. Nothing else can be done apart from closing the application
Can you describe that more or perhaps do a screenshot of it. Is it the program window but only very thin?

hatatat
Posts: 12
Joined: 01 Apr 2012, 06:53
Number of books owned: 0
Country: Germany

Re: BookCrop - batch crop right/left page images

Post by hatatat » 09 Apr 2016, 15:23

Hi,

so I installed exactly
"libjpeg-turbo-1.3.0-gcc64.exe" and
"GraphicsMagick-1.3.20-Q8-win64-dll.exe"

The result is still the same.

Additionally: if I press the R/L keys, another window appears.

Please find both (vertical line + the other window) attached.

Thanks for your support!
Attachments
error-message.jpg
error-message.jpg (10.16 KiB) Viewed 2336 times
vertical-line.jpg

dtic
Posts: 457
Joined: 06 Mar 2010, 18:03

Re: BookCrop - batch crop right/left page images

Post by dtic » 10 Apr 2016, 04:52

Ok, there is some problem related to the overlay preview image. Because no preview is generated (or faulty) the preview window has no content and becomes super thin. The problem is either with BookCrop or GraphicsMagick (not libjpeg).

1 What version of Windows do you have?

2 If you drop a single .jpg file (not a whole folder) on BookCrop do you still get the thin window or is a preview image shown?

3 Test this: drop a folder of jpg images, wait for the progress bar to finish and the thin window to appear. Then look inside the jpg folder. Is there an image file named "BookCrop.exe_over.png" in it? If yes then what does it look like?

4 Same as step 3 but drop only a single jpg

5 If there is no "BookCrop.exe_over.png" image file in step 3 or 4 then the problem might be with GraphicsMagick. Try this: open a cmd window and try this command (change paths to files to fit your system, gm.exe is graphicsmagick and image.jpg is a book page photo)

Code: Select all

C:\path to\gm.exe convert -size 300x300 "C:\some\folder\image.jpg" -sample 300x300 -threshold 30% -transparent white -flatten "C:\some\folder\test.png"
Does that create a test.png image?

hatatat
Posts: 12
Joined: 01 Apr 2012, 06:53
Number of books owned: 0
Country: Germany

Re: BookCrop - batch crop right/left page images

Post by hatatat » 10 Apr 2016, 06:38

Hi,

1. my version of Windows is: Windows 7 Home Premium, Service Pack 1 (Germany located)

2. If I drop a single .jpg file, I still get the thin window

3. If I drop a a folder of jpg files: inside the jpg filder, there is a BookCrop.exe_over.png. It contains the overlaid pictures of the jpgs in the folder.

4. If I just drop a single jpg, there is the BookCrop.exe_over.png file, too (and it just contains the png version of the jpg file...)

5. I tried your command. It works ok, but only if I omit the "%".

Further insights:
a) So, I tried BookCrop on another machine: Windows 8.0 (Germany located). Also here I get the same issue.

b) I tried to change the localisation of my computer, too (as far as this is possible with Windows 7). It did not help neither.

b) Depending from the picture I use as input, I can see "something" in the horizontal window - see attachment.
Attachments
something.jpg

dtic
Posts: 457
Joined: 06 Mar 2010, 18:03

Re: BookCrop - batch crop right/left page images

Post by dtic » 10 Apr 2016, 07:30

Ok. Since the preview image ( BookCrop.exe_over.png ) is generated ok the problem is in BookCrop and not GraphicsMagick.
I suspect BookCrop at some step gets the image dimensions wrong. But I don't see the error in the code yet.

6 What is your screen resolution and what is the resolution in pixels of the preview image ( BookCrop.exe_over.png ) made when dropping a single image on BookCrop?

7 Another test (presupposes that you have Autohotkey installed on the computer):
Open BookCrop.ahk in Notepad and find these lines

Code: Select all

makegui() {
global
Gui,5: destroy
Gui,6: destroy
and add this on the empty line directly below those lines and save

Code: Select all

Msgbox sh=%sh%`nsw=%sw%`nscreenheight=%a_screenheight%`nscreenwidth=%a_screenwidth%
Then run BookCrop.ahk (not .exe) and drop one book page photo .jpg in the window. A messagebox will pop up. What does it say?

hatatat
Posts: 12
Joined: 01 Apr 2012, 06:53
Number of books owned: 0
Country: Germany

Re: BookCrop - batch crop right/left page images

Post by hatatat » 10 Apr 2016, 08:23

6. My Screen Resolution is: 2560 x 1440
The resolution of BookCrop.exe_over.png is: 1000 x 1440 (as a jpg, I take the screenshot with the vertical line, so coincidentically the hight is identical for both)

7. the message box says:
sh=1310
sw=0
screenheight=1440
screenwidth=2560

Post Reply