简体   繁体   中英

Morena 7 Scanner completely ignores settings

I'm trying to setup Morena 7 in my java application, but i can't configure my scanner from my code, it ignores the settings i set.

Even though my scanner works with the example projects they provide with every supported setting. I have searched the web for explanations but i have found very little to none documentation.

This the code i use to scan, it is identical to sample given in the tutorial document :

    public void scan() throws Exception {
        Manager manager = Manager.getInstance();
        List devices = manager.listDevices();
        if(devices.isEmpty()) {
            System.out.println("No scanners detected");
            return;
        }
        Device device = (Device) devices.get(0);

        if (device instanceof Scanner)  {
            Scanner scanner = (Scanner) device;
            scanner.setMode(Scanner.RGB_8);
            scanner.setResolution(75);
            scanner.setFrame(100, 100, 500, 500);

            BufferedImage bimage = SynchronousHelper.scanImage(scanner);

            // Do the necessary processes with bimage  

            manager.close();
        }
        else {
            System.out.println("Please Connect A Scanner");
        }
    }

When i run this code, i get back an image but with default values from the printer, every setting like color, resolution and scan area (frame) are ignored.

First I think one reason can be the problem that Morena 7 always spools the scanner data into a file. You cannot access this scanner data before written to a file (unfortunately). So in case you want to scan bilevel images you will get a jpg image with greylevels. Morena saves scannerdata as jpg on Mac OSX and as a bmp on Windows.

You should check the temp file Morena 7 creates. Assuming you use the class SynchronousHelper from the Moran example you can edit the scanImage method which just loads the temp file using ImageIO.

If I check this temp file (on Mac OSX) all the set values as resolution and colormode are considered. Probably your scanner does not support some things? Or Morena does something wrong while saving the image.

And check the system error output. Should look something like the following where you can see that I set the resolution to 400dpi and the colormode to bilevel (ICScannerPixelDataTypeBW and bitDepth 1).

Functional unit: ICScannerFunctionalUnitFlatbed <0x7fefe850f4e0>:
  pixelDataType                            : ICScannerPixelDataTypeBW
  supportedBitDepths                       : <NSMutableIndexSet: 0x7fefe850f4b0>[number of indexes: 2 (in 2 ranges), indexes: (1 8)]
  bitDepth                                 : 1
  supportedDocumentTypes                   : <NSMutableIndexSet: 0x7fefede9a9f0>[number of indexes: 6 (in 2 ranges), indexes: (1-5 10)]
  documentType                             : 1
  physicalSize                             : [width = 8.50 inches, height = 14.00 inches]
  measurementUnit                          : 0
  supportedResolutions                     : <NSMutableIndexSet: 0x7fefedee4390>[number of indexes: 7 (in 7 ranges), indexes: (100 150 200 300 400 600 1200)]
  preferredResolutions                     : <NSMutableIndexSet: 0x7fefedee4390>[number of indexes: 7 (in 7 ranges), indexes: (100 150 200 300 400 600 1200)]
  resolution                               : 400
  overviewResolution                       : 150
  supportedScaleFactors                    : <NSMutableIndexSet: 0x7fefedec3dd0>[number of indexes: 1 (in 1 ranges), indexes: (100)]
  preferredScaleFactors                    : <NSMutableIndexSet: 0x7fefedec3dd0>[number of indexes: 1 (in 1 ranges), indexes: (100)]
  scaleFactor                              : 100
  acceptsThresholdForBlackAndWhiteScanning : NO
  usesThresholdForBlackAndWhiteScanning    : NO
  thresholdForBlackAndWhiteScanning        : 0
  templates                                : (null)
  vendorFeatures                           : (null)
  state                                    : 0x00000001

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM