GM-Script-Writer-62850 / PHP-Scanner-Server

Allows you to use your Linux install as a web based scanner server thus allowing you to scan with any web enabled device; Now supports server side printing! (As of 1.4.11)
59 stars 17 forks source link

Scan error centos 6.2 #2

Closed vukomir closed 11 years ago

vukomir commented 12 years ago
apache@10.95.205.5:/var/www/html/scan$ scanimage -d "XeroxPhaser3100:usb:002:002" -l 0 -t 0 -x 210 -y 297 --resolution 75 --mode Halftone --format=ppm > "/tmp/scan_file0.ppm"
The output of this command unfortunately has to be suppressed to prevent errors :(
apache@10.95.205.5:/var/www/html/scan$ convert "/tmp/scan_file0.ppm" -scale 450x471 "scans/Preview_0_Jul_24_2012~15-54-26.jpg"
convert: unable to read image data `/tmp/scan_file0.ppm' @ pnm.c/ReadPNMImage/659.
convert: missing an image filename `scans/Preview_0_Jul_24_2012~15-54-26.jpg' @ convert.c/ConvertImageCommand/2800.
apache@10.95.205.5:/var/www/html/scan$ convert "/tmp/scan_file0.ppm" -alpha off "scans/Scan_0_Jul_24_2012~15-54-26.png"
convert: unable to read image data `/tmp/scan_file0.ppm' @ pnm.c/ReadPNMImage/659.
convert: missing an image filename `scans/Scan_0_Jul_24_2012~15-54-26.png' @ convert.c/ConvertImageCommand/2800.
apache@10.95.205.5:/var/www/html/scan$ 
GM-Script-Writer-62850 commented 12 years ago

can you run sudo -u apache scanimage -d "XeroxPhaser3100:usb:002:002" -l 0 -t 0 -x 210 -y 297 --resolution 75 --mode Halftone --format=ppm > "/tmp/scan.ppm"

to me it looks like the scan is exiting in error, if centos does not use sudo all you have to do is run the command as apache and we will get what we need

vukomir commented 12 years ago

i run the command and didn't get any error on scan.

root@Merlin RC=0 /samba/public #  sudo -u apache scanimage -d "XeroxPhaser3100:usb:002:002" -l 0 -t 0 -x 210 -y 297 --resolution 75 --mode Halftone --format=ppm > "/tmp/scan.ppm"

when i tray to convert the file in a jpg i get:

root@Merlin RC=0 /tmp # convert "/tmp/scan.ppm" -scale 450x471 "/tmp/Preview_0_Jul_24_2012~15-54-26.jpg"
convert: unable to read image data `/tmp/scan.ppm' @ pnm.c/ReadPNMImage/659.
convert: missing an image filename `/tmp/Preview_0_Jul_24_2012~15-54-26.jpg' @ convert.c/ConvertImageCommand/2800.

from what i can see the file if generated ok.

root@Merlin RC=1 /tmp # file /tmp/scan.ppm
/tmp/scan.ppm: Netpbm PBM "rawbits" image data
GM-Script-Writer-62850 commented 12 years ago

try this one scanimage -d "XeroxPhaser3100:usb:002:002" -l 0 -t 0 -x 210 -y 297 --resolution 75 --mode Halftone --format=ppm > "/tmp/scan-test.ppm" can you open scan-test.ppm with a image viewer? what is the file size? if it looks like th file size of a image what at the 1st 5 lines it shows in a text viewer (cat /path/to/file | less)

Either you are getting a empty file or your version of scanimage is spitting output data at the top of the image file just thought of something IIRC Cent OS uses some really old software what version of imagemagick are you using i really don't know what the min version is on the dependencies (except imagemagick) simply because i never encountered old version oldest tested version:

user@lucid-desktop:~$ scanimage --version
scanimage (sane-backends) 1.0.20; backend version 1.0.20
chad@lucid-desktop:~$ convert --version
Version: ImageMagick 6.6.2-6 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP 

user@lucid-desktop:~$

Does your imagemagick support ppm?

user@lucid-desktop:~$ identify -list format | grep PPM
      PPM* PNM       rw+   Portable pixmap format (color)

I don't know the permissions on Cent OS bunt on ubuntu apache is named www-data so if the permission are the same apache would have to be in the lp group assuming assuming both use a lp group with the same name but since it could detect the scanner that should not be the issue

vukomir commented 12 years ago

Hi,

root@Merlin RC=0 /usr/local # scanimage --version
scanimage (sane-backends) 1.0.21; backend version 1.0.21
root@Merlin RC=0 /usr/local # convert --version
Version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
root@Merlin RC=0 /usr/local # identify -list format | grep PPM
      PPM* PNM       rw+   Portable pixmap format (color)
root@Merlin RC=0 /usr/local # ls -ld /samba/public/scan-test.ppm
-rw-r--r-- 1 root smb 67K Jul 26 10:53 /samba/public/scan-test.ppm

the ppm is ok, i can view the image. i will tray to update imagemagick with a new version to se if this will solve the problem.

Thanks for the support

GM-Script-Writer-62850 commented 12 years ago

When it was scanned with apache could you open the ppm (see post 2 for command) it is in the /tmp folder

vukomir commented 12 years ago

the file is ok when i scan with apache user.

GM-Script-Writer-62850 commented 12 years ago

Then it is most likely the version on ImageMagick, know the one on Ubuntu 10.04 works but one feature does not work

GM-Script-Writer-62850 commented 11 years ago

Closing this in the assumption that the problem was a old unsupported version of imagemagick, due to lack of reply from vukomir, i really wish people would post back when they figured out a fix it really can help other people, why would you wish your problems on others?