Skena pikicha album ine script kubva kumutsara wekuraira

Zviripachena pane akati wandei graphical interfaces yekuongorora mifananidzo, iyo inopa akawanda sarudzo. Asi kana iyo nhamba yemifananidzo inofanirwa kuongororwa yakakura uye isu tisina scanner iyo ine otomatiki sheet feeder, zvinhu zvinoomarara. Kazhinji unofanirwa kudzvanya kuti utarise, kumwe kudzvanya pamwe kune imwe kumucheto kwehwindo kuti uchengetedze… zvinotora nguva. Zvisinei, chikonzero chakanaka chekushandisa iyo Raira mutsara.

Uyu mupiro kubva kuna Rubén, nekudaro uchiva mumwe wevanokunda kumakwikwi edu evhiki: «Goverana zvaunoziva nezve Linux«. Makorokoto Rubén!

Ndakaverenga zvinyorwa zvacho pa Batch Image Kugadziriswa neGIMP y Maitiro ekushandisa zvisirizvo mifananidzo kubva kune iyo terminal, iro zuva chete shamwari yangu Huguito paakandibvunza mafoto (aakange arasa) erwendo rwatakaita muna 1989… (4 rolls of 36 photos! and on paper, of course 🙂. kuti ndakanga ndakanganwa.

Pfungwa ndeye kushandisa script kuti uzviite nekukurumidza sezvazvinogona:

1.- Isa pikicha pane scanner
2.- Dhinda chero kiyi yekutarisa
3.- Dzokorora maitiro, kunze kwekunge kiyi yakadzvanywa ndeyekuti 'n' kubuda
4.- Mifananidzo yacho ichachengetedzwa uye kuverengerwa mu-pre-yakasimbiswa subdirectory.

Murayiro upi?

Iwo 'wemashiripiti' wekuraira scanimage inova chikamu cheSANE. SANE iAPI iyo inopa yakaenzana kuwana kune chero imaging chishandiso. Iyo Sane API iri munharaunda yeruzhinji uye kodhi yayo yekodhi inowanikwa pasi peGNU General Public License.

Kuisirwa kuri nyore. Kugoverwa kwega kwega kunounza mapakeji ayo. ZveUbuntu (kana zvigadzirwa zvayo), zvinokwana kushandisa synaptic uye kumisikidza zvine musoro uye zvine musoro-zvishandiso.

Kushandisa sei?

Nguva dzose zvakanakisa sei kunyora mune inouraya 'murume scanimage'. Nekudaro, isu tichapfupisa sarudzo dzatichazoshandisa.

Isu tinovhura terminal uye tinomhanya scanimage -L kuti uone zvishandiso zviripo:

mufananidzo -L

Mune yangu nyaya inodzoka:

chishandiso `xerox_mfp: libusb: 001: 005 'ndeye SAMSUNG ORION yakawanda-inoshanda periipheral

Iyi ndiyo mhedzisiro yaakandipa ine yangu Samsung SCX-4200 multifunction. Kana iwe uine MFP uye iwe usingakwanise kuwana chishandiso, ita shuwa kuti iyo printa haina kushanda, semuenzaniso ine yakamirira kudhinda.

Iko kukosha 'xerox_mfp: libusb: 001: 003' inoshandiswa kuudza iyo scanimage rairo iyo mudziyo wekushandisa kuburikidza ne-- d Sarudzo. Kana imwechete scanner yakabatana, iyi sarudzo haina kudikanwa.

Kana iyo scanimage rairo ichitarisa, inotumira iyo inoguma mufananidzo kune yakajairwa kuburitsa mu pnm kana tiff fomati. Saka kuti titarise isu tinonongedza zvakabuditswa kune faira. Uye kana isu tichida kuona kuti ndeapi mameseji ari kurairwa, tinowedzera iyo -v sarudzo. Kana isu tichidawo kuona iyo chikamu chekufambira mberi kwekushanda, isu tinowedzera iyo -p Sarudzo.

scanimage -v -p> mufananidzo.tiff

scanimage: scanning mufananidzo wehukuru 1284x1734 pixels pa24 bits / pixel
scanimage: kuwana RGB furemu
scanimage: min / max greylevel kukosha = 69/255
scanimage: verenga 6679368 byte muhuwandu
Kufambira mberi: 13.8%

Chii icho chingatipe isu kana isu tikaita scanimage -help? Zvinotaridza sezviri pachena, zvinopa rubatsiro pamurairo. Asi uyu murairo une peculiarity. Pakupera kwerubatsiro rwe generic yekuraira wedzera iwo chaiwo ma parameter ayo scanner yako inogamuchira.

scanimage --help

Usage: scanimage [OPTION] ...

BLA bla ....

Sarudzo dzakananga kuchinhu 'xerox_mfp: libusb: 001: 005':

standard:
--resolution 75 | 100 | 150 | 200 | 300 | 600dpi [150] Inoisa chisarudzo chemufananidzo wakavhenekwa.
-mode Lineart | Halftone | Grey | Ruvara [Ruvara] Inosarudza iyo scan mode (semuenzaniso, lineart, monochrome, kana ruvara).
--highlight 30..70% (mumatanho gumi) [isingashande] Sarudza kushoma-kupenya kuti utore chena poindi
--source Flatbed | ADF | Auto [Flatbed] Inosarudza scan scan (senge gwaro-rinodyisa).
Jiyometri:
-l 0..215.9mm (mumatanho e1) [0] Kumusoro-kuruboshwe x chinzvimbo che scan scan.
-t 0..297.18mm (mumatanho e1) [0] Kumusoro-kuruboshwe uye chinzvimbo che scan nzvimbo.
-x 0..215.9mm (mumatanho e1) [215.9] Upamhi hwenzvimbo yekuongorora.
-y 0..297.18mm (mumatanho e1) [297.18] Kureba kwenzvimbo yekuongorora.

Nyora `` scanimage -help -d DEVICE '' kuti uwane runyorwa rweese sarudzo dzeDEVICE.

Chinyorwa chemidziyo inowanikwa:

xerox_mfp: libusb: 001: 005

Kubva pano tinogona kusarudza sarudzo nemitengo yatinogona kushandisa.

Muenzaniso:

Kugadzirisa

-Chisarudzo 150

Modo

-Mode Ruvara

Iye zvino geometry. Izvi zvinonyanya kubatsira nekuti tinogona kutaurira scanner kuti ibvise chete mufananidzo wedunhu (uko kwatinoisa mufananidzo), uye tinochengetedza iyo nguva yekuvhenekera iyo yese yepasi iyo yatinofanira kuchekawo gare gare neyemifananidzo mhariri yakadaro seGimp.

-l 0 inotanga kutenderedza yakatwasuka kubva pa0 mm kubva pakona yekumusoro yekuruboshwe yeiyo scanner

-t 0 inotanga kutarisisa yakatwasuka kubva pa0 mm kubva pakona yekumusoro yekuruboshwe yeiyo scanner

Ziva kuti ini ndakasarudza kuisa pikicha mukona yeiyo scanner [makonati (0,0)], nekuti zviri nyore kuisa. Pane yangu scanner (saizi yeA4) l ndinogona kubva pa0 kusvika 215.9 uye t kubva pa0 kusvika pa297.18.

Upamhi uye Kureba kwemufananidzo. Mune yangu kesi mapikicha ari 13x18cm:

-x 180 yakafara

-uye 130 kukwirira

Naizvozvo zvinongotarisa chikamu chatinoisa pikicha yedu. Ehezve, kana tikabvumirana pane izvo zvasara, kurudyi, upamhi, kukwirira, kumusoro uye pasi. Zvinoenderana nekuti unotarisa sei scanner yako. Ini ndinokurudzira kuyedza makonati nekugadzirisa iwo kune izvo zvaunoda.

Muenzaniso wemirairo unogona kunge uri:

scanimage -d xerox_mfp: libusb: 001: 003 -p --mode Ruvara --resolution 150 -l 0 -t 0 -x 180 -y 130> image.pnm

Nesarudzo idzi, tinogona kutogadzira yedu script.

Asati…

Tiff kana pnm mafomu asina kumanikidzwa, saka mapikicha edu anotora rakakura dhisiki nzvimbo. Apa ndipo panouya iyo ImageMagick inoshandura rairo inouya inotsanangurwa mu Maitiro ekushandisa mifananidzo kubva kune iyo terminal.

Kana isu tikawana mufananidzo.pnm kubva pa scanner, tinogona kuishandura kuva jpg:

chinja image.pnm image.jpg

Asi usati waita kudaro, imwe hunyengeri:

Mufananidzo.pnm unotora yakawanda nzvimbo uye isu tinofanirwa kuidzima mushure mekuwana yedu image.jpg. Iko kune sarudzo yemutemo wekushandura kuitira kuti pachinzvimbo chekutora faira kubva kudiski inonyatso shandura yakajairwa yekuisa. Izvi zvinoitwa ne dash - panzvimbo yefaira:

shandura - image.jpg

Sezvo scanimage inounza iyo yakaongororwa mufananidzo kune yakajairwa kuburitsa, isu tinoita "pombi" uye chengetedza iyo yekugadzirisa nguva inotora kunyora uyezve kudzima iyo image.pnm faira kubva ku disk.

scanimage -d xerox_mfp: libusb: 001: 003 -p --mode Ruvara --resolution 150 -l 0 -t 0 -x 180 -y 130 | shandura - image.jpg

Zvino hongu, chinyorwa ...

Isu tinonyora inotevera kodhi mune faira iyo yatinozodaidza scan-album.sh uye tinoipa mvumo yekuita. Patinoimhanyisa, inogadzira subdirectory uko edu mapikicha akavezwa. Rangarira kugadzirisa iwo paramende kukosha kune zvaunoda.

Ive neshuwa yekuverenga mamwe mazano mushure meiyo script.

#! / bin / bash
# Dhata yesarudzo

VERBOSE = "" # ona status msg: "" haisi; "-v" hongu
KUFAMBIRA = "- p" # kuratidza kufambira mberi "" kwete; "-p" hongu

# Iyi inotevera parameter inopihwa ne scanimage --help kune yako scanner
#Device: Kana paine imwechete scanner, hazvidiwe, isa DEV = ""
# DEV = "xerox_mfp: libusb: 001: 003"

DEV = ""
Mode = "- rudzi Ruvara"
Sarudzo = "- resolution 600dpi"

#geometry, eg 130x180 mm pikicha
#kuiswa munzvimbo yekumusoro kuruboshwe vertex scanner

x0 = 0
y0 = 0
upamhi = 180
kukwirira = 130

#sarudzo:

L = "- l $ x0"
T = "- t $ y0"
UPENYU = "- x $ upamhi"
HIGH = "- uye $ kumusoro"

# ese ma parameter pamwechete:

PARAMETERS = "$ DEV $ VERBOSE $ PROGRESS $ MODE $ RESOLUTION $ L $ T $ WIDTH $ HIGH"

# Zita reiyo albamo. Gadzira subdirectory ine zita rako:

ALBHAMU = "Mazororo_1989"

# Zvekuchengeteka, ini hapana chandinoita kana dhairekitori ratovepo

mkdir $ ALBHAMU

kana ["$?" = "1"]; ipapo
kubuda 100
fi

# Base zita remifananidzo (mune sub dir)

FILE = "./" $ ALBHAMU / / "$ ALBHAMU" _foto_ "

basa mubvunzo () {
akarasa "--------------------------------------------------- - ------------------------- "
echo
akandwa "*****************************"
echo "Kwete yemifananidzo yakaongororwa:" "$ I"
akandwa "*****************************"
echo -e "Dhinda: n * n kubuda * Imwe kiyi yekutarisa."
echo
verenga -s -n1 -p "Tarisa mufananidzo mutsva?" bhatani
echo
}

################################

# Kutanga

################################

Ini = 0

mubvunzo

apo ["$ keypress"! = "n"]; ita
# foto nyowani yekutarisa
rega "ini + = 1"
ZITA = $ FILE $ I
scanimage $ PARAMETERS | chinja - $ NAME.jpg
mubvunzo
nokuita

Mazano

Uchishandisa zvisarudzo zvakakwirira senge zviri mumuenzaniso zvinoita kuti scan yacho inonoke.

Ramba uchifunga kuti kana iwe uchida kupurinda pikicha pabepa iwe unoda nezve mazana maviri nemakumi mashanu emadhiza padiki Kana iyo pfungwa yekuvheneka mapikicha iri kuadhinda iwo akaenzana saiyo sepakutanga, resolution ye250 inokwana.Kuti uvaone pane yekutarisa, zana zvakakwana. Kugadziriswa kwepamusoro kwaizoshandira kukudza.

Maki yemifananidzo inofanirwa kugadzirirwa pamberi kuitira kuti pikicha yega yega ive kurudyi. Nenzira iyi hauzopedza nguva kuiisa mu scanner kuti irege kutenderedzwa 180º.

Kana uchienzanisa zviyero zvejometri parameter, zvinokurudzirwa kucherechedza kuti chinzvimbo chekuisa chepakutanga, kuitira kuti mifananidzo yedhijitari irege "kukomberedza". Mune yangu kesi chikamu chepazasi chemufananidzo chinoenda pamwe neiyo 'l' axis.

Kana iwe uine imwechete scanner yakabatana inzwa wakasununguka kusashandisa iyo -d Sarudzo. Mune chinyorwa chiri DEV = »»

Dzimwe nguva nhamba dzinochinja mu "xerox_mfp: libusb: 001: 003" uye uchafanirwa kuchichinja pese paunoshandisa script.

Chenjerera mahedheni uye makotesheni kana uchiteedzera script. Iyo hyphens (iyo minus sign) inogona kuve imwechete kana maviri pamwechete zvichienderana nesarudzo; iwo makotesheni emakesi ari maviri pane iyo keyboard, iwo haasi iwo ayo mamwe mazwi ma processor senge LibreOffice anoisa.

Zvekuchengetedza, iyo script haina kugadzira dhairekitori kana yatovepo, kuti isazonyora mafaira kana paine chero. Panguva iyoyo inomira.

Kana iyo foto albha yakare, usazvidemba kana mifananidzo iine bvudzi rakawanda, makwinya kana kilos asipo: -


Izvo zviri muchinyorwa zvinoomerera pamisimboti yedu ye tsika dzekunyora. Kuti utaure chikanganiso tinya pano.

Makomendi gumi, siya zvako

Siya yako yekutaura

Your kero e havazobvumirwi ichibudiswa. Raida minda anozivikanwa ne *

*

*

  1. Inotarisira iyo data: Miguel Ángel Gatón
  2. Chinangwa cheiyo data: Kudzora SPAM, manejimendi manejimendi.
  3. Legitimation: Kubvuma kwako
  4. Kutaurirana kwedata
  5. Dhata yekuchengetedza: Dhatabhesi inobatwa neOccentus Networks (EU)
  6. Kodzero: Panguva ipi neipi iwe unogona kudzora, kupora uye kudzima ruzivo rwako

  1.   Juniors Calderon akadaro

    Wow! Iyo yakanaka tuto!
    Ini handina kufunga kuti zvinhu zvakawandisa zvinogona kuitwa neiyo bash xD
    Mazuva ese iwe unodzidza zvakawanda!
    Ndatenda nekuisa!
    Ini handina Scaner asi kana ndikawana, ndinobva ndangozviidza 🙂

  2.   Rube akadaro

    Mupiro uyu unondibatsira zvakadii mukuverenga manotsi angu, ndinovimba anovandudza, ndiri kufunga nezve basa rekutora izere faira uye nekuona saizi yechinhu chakaongororwa, sezvo tichivimba nemufananidzo magick, inogona chinjana kuva djvu kana pdf uye nekudaro gadzira faira rimwe chete. Zvakanaka ini ndakangotambaira. Ndatenda zvikuru nemupiro.

  3.   zvide akadaro

    Iko kunakidzwa kukuru, ndinokutendai zvikuru nekugovana.