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

Two newcomer problems

Discussion about Steve DeVore's Book Scan Wizard, a power-user package to automate scan processing.
steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Two newcomer problems

Post by steve1066d » 15 Nov 2013, 12:45

Have you tried directly loading the PDF into BSW?

Try:

LoadImages = source.pdf

LoadLRImages doesn't support pdf inputs (It is easy enough to add though... If your source pdf's work with LoadImages I'll add support for pdf to LoadLRImages.

BTW, while the automated notify messages from this site come from Rob, its actually Steve that you are talking to.
Steve Devore
BookScanWizard, a flexible book post-processor.

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Two newcomer problems

Post by steve1066d » 15 Nov 2013, 22:18

I uploaded a new version that allows you to import a PDF file using the LoadLRImages. The version is 2.0 beta 5.

https://sourceforge.net/projects/booksc ... urce=files
Steve Devore
BookScanWizard, a flexible book post-processor.

DanE
Posts: 30
Joined: 17 Oct 2013, 03:09
Number of books owned: 0
Country: US

Re: Two newcomer problems

Post by DanE » 16 Nov 2013, 01:38

Hi Steve,
Sorry about my confusion as to your identity.

I've placed a copy of the original pdf in the source folder and run the following:
# Book Scan Wizard Script
# http://bookscanwizard.sourceforge.net
# /Users/essin/BookScanWork


# *** Load Files ***
# the source directory
LoadLRImages = source

# Override source DPI
SetSourceDPI = 300

# The Destination directory
SetDestination = pdf

# *** Remove Pages ***

# *** Perspective ***

# *** Crops ***
Pages = left
Crop = 26,20, 1516,2400
Pages = right
Crop = 1600,20, 3126,2400

# *** Filters ***
Pages = all
Color = gray
Levels = 59 60

#Change to a binary (black & white) image, with a clipping point of 60%
#Color=bw 60

# *** Scaling ***
Pages = all
# Overrides the destination DPI to 300 (does not scale the image)
SetDestinationDPI = 300

# This will ensure the left and right pages are exactly the same size.
ScaleToFirst=

# *** Output ***
Pages=all
CreatePDF = BookScanWork.pdf

---
I've tried it with loadImages and LoadRLImages as well and get the following errors/messages:

Caused by: Crop area (26,20, 1516,2400 is outside 0,0, 1 1
at net.sourceforge.bookscanwizard.op.Crop.performOperation(Crop.java:85)
at net.sourceforge.bookscanwizard.Operation.performOperations(Operation.java:355)
at net.sourceforge.bookscanwizard.BSW.processFile(BSW.java:524)
at net.sourceforge.bookscanwizard.BSW.access$500(BSW.java:72)
at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:413)
at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:410)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

and

java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space components do not match
at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:482)
at com.sun.media.jai.opimage.ColorConvertOpImage.computeRectNonColorSpaceJAI(ColorConvertOpImage.java:369)
at com.sun.media.jai.opimage.ColorConvertOpImage.computeRect(ColorConvertOpImage.java:289)
at javax.media.jai.PointOpImage.computeTile(PointOpImage.java:919)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:912)
at javax.media.jai.OpImage.getTile(OpImage.java:1139)
at javax.media.jai.PointOpImage.computeTile(PointOpImage.java:916)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:912)
at javax.media.jai.OpImage.getTile(OpImage.java:1139)
at javax.media.jai.PlanarImage.copyData(PlanarImage.java:2356)
at javax.media.jai.PlanarImage.copyData(PlanarImage.java:2292)
at javax.media.jai.RenderedOp.copyData(RenderedOp.java:2296)
at net.sourceforge.bookscanwizard.gui.MainFrame.setImage(MainFrame.java:713)
at net.sourceforge.bookscanwizard.BSW.preview(BSW.java:351)
at net.sourceforge.bookscanwizard.gui.GuiActions.cursorActionPerformed(GuiActions.java:205)
at net.sourceforge.bookscanwizard.gui.UserFeedbackHelper.actionPerformed(UserFeedbackHelper.java:46)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:713)
at java.awt.EventQueue.access$000(EventQueue.java:104)
at java.awt.EventQueue$3.run(EventQueue.java:672)
at java.awt.EventQueue$3.run(EventQueue.java:670)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:686)
at java.awt.EventQueue$4.run(EventQueue.java:684)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:683)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Exception in thread "pool-1-thread-416" java.lang.NullPointerException
at net.sourceforge.bookscanwizard.gui.ThumbTable$ImageRequest.run(ThumbTable.java:381)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

If I comment out the crops then I get:
Caused by: java.lang.IllegalArgumentException: The specified ColorModel is incompatible with the image SampleModel.
at javax.media.jai.PlanarImage.setImageLayout(PlanarImage.java:541)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:810)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2190)
at net.sourceforge.bookscanwizard.op.ScaleToFirst.performOperation(ScaleToFirst.java:38)
at net.sourceforge.bookscanwizard.Operation.performOperations(Operation.java:355)
at net.sourceforge.bookscanwizard.BSW.processFile(BSW.java:524)
at net.sourceforge.bookscanwizard.BSW.access$500(BSW.java:72)
at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:413)
at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:410)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

I must be missing something.

Thanks,
Dan

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Two newcomer problems

Post by steve1066d » 16 Nov 2013, 01:46

Try setting the LoadLRImages to the path of the pdf file. So somethings like this:

LoadLRImages = /Users/essin/BookScanWork/somefile.pdf

If that doesn't work, can you send me or upload your pdf file?
Steve Devore
BookScanWizard, a flexible book post-processor.

DanE
Posts: 30
Joined: 17 Oct 2013, 03:09
Number of books owned: 0
Country: US

Re: Two newcomer problems

Post by DanE » 16 Nov 2013, 03:42

Hi Steve,

I'm still getting this exception. The file is attached.
Caused by: java.lang.IllegalArgumentException: The specified ColorModel is incompatible with the image SampleModel.
at javax.media.jai.PlanarImage.setImageLayout(PlanarImage.java:541)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:899)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:810)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2190)
at net.sourceforge.bookscanwizard.op.ScaleToFirst.performOperation(ScaleToFirst.java:38)
at net.sourceforge.bookscanwizard.Operation.performOperations(Operation.java:355)
at net.sourceforge.bookscanwizard.BSW.processFile(BSW.java:524)
at net.sourceforge.bookscanwizard.BSW.access$500(BSW.java:72)
at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:413)
at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:410)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

Thanks,
Dan
Attachments
Chaffee.pdf
(3.08 MiB) Downloaded 160 times

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Two newcomer problems

Post by steve1066d » 16 Nov 2013, 15:32

I gave up on reading the PDF... I tried a couple different libraries and they all have problems reading that file. The issue is that the PDF is saved as all text. BSW can read PDF's as long as each page is one image.

There was also a problem with the Color = gray operation when dealing with black & white images. However, as all you are trying to do is crop, and you don't need to modify colors or brightness, you don't need to do any color conversions.

I was able get it to work by saving the pdf pages as tiff or png. Either of those formats will be lossless.

I also find a problem with the thumbnails for the tiff and png images, which I fixed. Also converting black and white to grayscale should work now (though in your case there is no reason to do so). Also, if the first non-removed page is on the left side the pdf it won't put the first page by itself when viewing the pages 2 up. I uploaded beta 6 with these changes.

Code: Select all

# Book Scan Wizard Script
# http://bookscanwizard.sourceforge.net
# /Users/essin/BookScanWork

# *** Load Files ***
# the source directory
LoadLRImages = source

# The Destination directory
SetDestination = pdf

# *** Remove Pages ***
# *** Perspective ***
# *** Crops ***
Pages = left
Crop = 26,20, 1516,2400
Pages = right
Crop = 1600,20, 3126,2400

# *** Filters ***
# *** Scaling ***
# Overrides the destination DPI to 300 (does not scale the image)
Pages = all
SetDestinationDPI = 300

# *** Output ***
Pages=all
CreatePDF = BookScanWork.pdf
Once you start using bsw with color images things should go a lot smoother for you.
Steve Devore
BookScanWizard, a flexible book post-processor.

DanE
Posts: 30
Joined: 17 Oct 2013, 03:09
Number of books owned: 0
Country: US

Re: Two newcomer problems

Post by DanE » 16 Nov 2013, 18:58

Hi Steve,

Thanks for the work. I'll try this out. If I run into problems, I think I will wait until I have my scanner and cameras assembled. The the images that are produced should be more of what BSW expects.

Dan

DanE
Posts: 30
Joined: 17 Oct 2013, 03:09
Number of books owned: 0
Country: US

Re: Two newcomer problems

Post by DanE » 16 Nov 2013, 19:17

fyi, I got this exception

java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: jj2000.j2k.roi.MaxShiftSpec.<init>(IIBLjava/lang/String;)V
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at net.sourceforge.bookscanwizard.BSW$4.run(BSW.java:473)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodError: jj2000.j2k.roi.MaxShiftSpec.<init>(IIBLj
ava/lang/String;)V
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriteParamJava.set
ROIs(J2KImageWriteParamJava.java:850)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriteParamJava.set
Defaults(J2KImageWriteParamJava.java:754)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriteParamJava.set
Defaults(J2KImageWriteParamJava.java:750)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriteParamJava.<in
it>(J2KImageWriteParamJava.java:638)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriter.write(J2KIm
ageWriter.java:236)
at net.sourceforge.bookscanwizard.op.SaveImages.writeJpeg2000Image(SaveI
mages.java:218)
at net.sourceforge.bookscanwizard.op.CreatePDF.getImageAsBytes(CreatePDF
.java:179)
at net.sourceforge.bookscanwizard.op.CreatePDF.performOperation(CreatePD
F.java:98)
at net.sourceforge.bookscanwizard.Operation.performOperations(Operation.
java:355)
at net.sourceforge.bookscanwizard.BSW.processFile(BSW.java:524)
at net.sourceforge.bookscanwizard.BSW.access$500(BSW.java:72)
at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:413)

at net.sourceforge.bookscanwizard.BSW$ProcessImages$1.call(BSW.java:410)

at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Two newcomer problems

Post by steve1066d » 16 Nov 2013, 21:23

I made a mistake on the upload... Try downloading it again.
Steve Devore
BookScanWizard, a flexible book post-processor.

DanE
Posts: 30
Joined: 17 Oct 2013, 03:09
Number of books owned: 0
Country: US

Re: Two newcomer problems

Post by DanE » 18 Nov 2013, 17:47

Hi Steve,

I've setup 6a

Using the pdf as input with the facing pages as source,
set the crops,
everything previews correctly - a left, then a right, then a left - just what I want,
then submit,
no exceptions but the generated pdf looks just like the source with 2 facing images per page.

same result on Mac and Windows - no surprise there.

Any thoughts?

Dan

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest