Skip to content

Commit 4d38423

Browse files
committed
Add documentation and image formats dropdown
1 parent 8c4133c commit 4d38423

File tree

5 files changed

+95
-5
lines changed

5 files changed

+95
-5
lines changed

CONTRIBUTING.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Contributing to this repository
2+
3+
## Testing
4+
5+
Please test the application with your cameras and report success/failure under <https://github.com/datazuul/eazy-bookscanner/discussions/categories/show-and-tell>
6+
7+
## Based on
8+
9+
* Canon Hack Development Kit (on camera): <https://chdk.fandom.com/wiki/CHDK>
10+
* CHDK-PTP-Java: Our fork <https://github.com/datazuul/CHDK-PTP-Java> of <https://github.com/acamilo/CHDK-PTP-Java>
11+
12+
## Development
13+
14+
Development was done
15+
16+
* JDK: OpenJDK 11.0.8
17+
* Build: Apache Maven 3
18+
* IDE: Apache NetBeans 12.1
19+
* Snapshot Libraries (clone them, too for local build/customization):
20+
21+
* CHDK-PTP-Java: <https://github.com/datazuul/CHDK-PTP-Java>
22+
23+
Make sure source code at least compiles with `mvn clean install`.
24+
25+
This software is based on [Apache NetBeans Platform ](http://netbeans.apache.org/kb/docs/platform/index.html).
26+
Main part of application is in submodule `application` and is easy to understand if you are familiar with [Swing](https://docs.oracle.com/javase/tutorial/uiswing/index.html).

README.md

+34-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,40 @@
1-
# datazuul-bookscanner
1+
# Eazy BookScanner
22

33
OpenSource Book Scanner application for digitizing books with two cameras.
44
Usage for two digital cameras like described at <http://diybookscanner.org/>.
55

6-
Supports:
6+
![Screenshot GUI Eazy BookScanner](./screenshot-20201221.jpg)
7+
8+
## Features
9+
10+
* Supported output image formats: JPG, TIF, PNG
11+
* Setup Mode: take unsaved test pictures for adjusting/exchanging left/right camera, image rotation and zoom before starting production shots with save
12+
* Synchronous two camera shots
13+
14+
## Requirements
15+
16+
* Java 1.8 or above
17+
18+
## Supported cameras
719

820
* CHDK Canon Digital cameras
21+
22+
```
23+
WARNING: Using this software is at your own risk!
24+
25+
See also https://chdk.fandom.com/wiki/FAQ:
26+
"CHDK comes with no warranty for any use; you use it at your own risk."
27+
```
28+
29+
Successfully tested on:
30+
31+
|Camera Vendor (Id)|Product (Id)|Operating System|Java Version|
32+
|-----|-----|-----|-----|
33+
|Canon (0x04a9)|A2200 (0x322a)|Linux (Debian GNU/Linux 10)|OpenJDK 11.0.8|
34+
|Canon (0x04a9)|A2200 (0x322a)|Linux (Ubuntu 20.04.1 LTS) |OpenJDK 11.0.4|
35+
36+
Happy book scanning!
37+
38+
## Feedback
39+
40+
Please start discussions here: <https://github.com/datazuul/eazy-bookscanner/discussions>

core/src/main/java/com/datazuul/bookscanner/core/ThumbnailsAndScanPanel.form

+11
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@
6666
</Property>
6767
</Properties>
6868
</Component>
69+
<Component class="javax.swing.JComboBox" name="formatNamesDropdown">
70+
<Properties>
71+
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
72+
<StringArray count="0"/>
73+
</Property>
74+
</Properties>
75+
<AuxValues>
76+
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
77+
</AuxValues>
78+
</Component>
6979
<Component class="javax.swing.JCheckBox" name="setupModeCheckbox">
7080
<Properties>
7181
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
@@ -74,6 +84,7 @@
7484
<Property name="selected" type="boolean" value="true"/>
7585
<Property name="text" type="java.lang.String" value="Setup Mode"/>
7686
<Property name="toolTipText" type="java.lang.String" value="uncheck to start saving images into project folder"/>
87+
<Property name="alignmentX" type="float" value="1.0"/>
7788
</Properties>
7889
<Events>
7990
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="setupModeCheckboxStateChanged"/>

core/src/main/java/com/datazuul/bookscanner/core/ThumbnailsAndScanPanel.java

+24-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@
1010
import com.datazuul.bookscanner.core.devices.CameraFactory;
1111
import com.datazuul.bookscanner.core.workers.CaptureAndSaveWorker;
1212
import java.awt.Adjustable;
13-
import java.awt.Color;
1413
import java.awt.Component;
1514
import java.awt.event.AdjustmentEvent;
1615
import java.awt.event.AdjustmentListener;
1716
import java.awt.image.BufferedImage;
1817
import java.io.File;
18+
import java.util.ArrayList;
1919
import java.util.Collection;
20+
import java.util.Iterator;
21+
import java.util.List;
2022
import java.util.logging.Level;
2123
import java.util.logging.Logger;
24+
import javax.imageio.ImageIO;
25+
import javax.imageio.ImageWriter;
26+
import javax.swing.DefaultComboBoxModel;
2227
import javax.swing.JScrollBar;
2328
import javax.swing.JScrollPane;
2429
import javax.usb.UsbDisconnectedException;
@@ -52,6 +57,16 @@ public ThumbnailsAndScanPanel() {
5257
initCameras();
5358
targetDirectory = System.getProperty("user.home"); // default
5459
projectDirectoryPathLabel.setText(targetDirectory);
60+
61+
String[] formatNames = new String[]{"jpg", "tif", "png"};
62+
List<String> supportedFormatNames = new ArrayList<>();
63+
for (String formatName : formatNames) {
64+
Iterator<ImageWriter> imageWritersByFormatName = ImageIO.getImageWritersByFormatName(formatName);
65+
if (imageWritersByFormatName.hasNext()) {
66+
supportedFormatNames.add(formatName);
67+
}
68+
}
69+
formatNamesDropdown.setModel(new DefaultComboBoxModel(supportedFormatNames.toArray()));
5570

5671
if (cam1 != null && cam2 != null) {
5772
leftCamera = cam1;
@@ -154,6 +169,7 @@ private void initComponents() {
154169
projectDirectoryLabel = new javax.swing.JLabel();
155170
chooseDirectory = new javax.swing.JButton();
156171
projectDirectoryPathLabel = new javax.swing.JLabel();
172+
formatNamesDropdown = new javax.swing.JComboBox<>();
157173
setupModeCheckbox = new javax.swing.JCheckBox();
158174
thumbnailsScrollPane = new javax.swing.JScrollPane();
159175
thumbnailsContainerPanel = new javax.swing.JPanel();
@@ -190,10 +206,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
190206
projectDirectoryPathLabel.setPreferredSize(new java.awt.Dimension(500, 20));
191207
directoryPanel.add(projectDirectoryPathLabel);
192208

209+
directoryPanel.add(formatNamesDropdown);
210+
193211
setupModeCheckbox.setBackground(new java.awt.Color(255, 255, 0));
194212
setupModeCheckbox.setSelected(true);
195213
setupModeCheckbox.setText("Setup Mode");
196214
setupModeCheckbox.setToolTipText("uncheck to start saving images into project folder");
215+
setupModeCheckbox.setAlignmentX(1.0F);
197216
setupModeCheckbox.addChangeListener(new javax.swing.event.ChangeListener() {
198217
public void stateChanged(javax.swing.event.ChangeEvent evt) {
199218
setupModeCheckboxStateChanged(evt);
@@ -345,6 +364,7 @@ private void setupModeCheckboxStateChanged(javax.swing.event.ChangeEvent evt) {/
345364
private javax.swing.JButton chooseDirectory;
346365
private javax.swing.JPanel directoryPanel;
347366
private javax.swing.JButton exchangeScanPanelsBtn;
367+
private javax.swing.JComboBox<String> formatNamesDropdown;
348368
private com.datazuul.bookscanner.core.ScanPanel leftScanPanel;
349369
private javax.swing.JPanel middlePanel;
350370
private javax.swing.JLabel projectDirectoryLabel;
@@ -375,8 +395,9 @@ private void shoot() {
375395
// create new thumbnailPanel to be filled
376396
ThumbnailsPanel thumbnailsPanel = new ThumbnailsPanel();
377397

378-
String imageFormat = "png";
379-
String filenameExtension = ".png";
398+
String selectedFormat = (String) formatNamesDropdown.getSelectedItem();
399+
String imageFormat = selectedFormat;
400+
String filenameExtension = "." + selectedFormat;
380401
String leftFilename = "image-" + StringUtils.leftPad(String.valueOf(leftNumber), 5, '0') + filenameExtension;
381402
String rightFilename = "image-" + StringUtils.leftPad(String.valueOf(rightNumber), 5, '0') + filenameExtension;
382403

screenshot-20201221.jpg

195 KB
Loading

0 commit comments

Comments
 (0)