Maitiro ekuwedzera watermark nekukurumidza uye muhuwandu

wedzera watermark nekukurumidza uye muhuwandu

Iyi ndiyo nzira yandiri kushandisa parizvino wedzera watermark kana watermark kublog mifananidzo. Ini kazhinji ndine mafoto akakwana ezvinyorwa uye neiyi bash script ini ndinowedzera iyo watermark mumasekonzi maviri kana matatu.

Nguva pfupi yapfuura ndakashandisa GIMP yekugadzirisa misa. Iyi sarudzo, iyo takaona pablog zvichiri kushanda, asi izvi zvinoratidzika nekukurumidza kwandiri uye sezvandinotaura ndizvo zvandiri kushandisa izvozvi.

Iyi nzira yakanakirawo vatori vemifananidzo vanofanirwa kupfuudza mapikicha akamaka kune vatengi, nekuti mumasekonzi mashoma iwe unoagadzirisa.

Ehe, mhinduro yevashandisi veLinux, ndiri kushandisa Ubuntu. Iye zvino ndinokusiira iwe script uye nhanho-nhanho tsananguro kuitira kuti iwe urege kungoishandisa chete asiwo unzwisise zvainoita uye wotanga kudzidza BASH. Kune mitsetse 8 chete.

Shandisa ImageMagick unofanira kuiisa kuti script ikushandire. Vhura terminal uye mhando

sudo apt install imagemagick

Neizvi tinogona kushandisa iyo ImageMagick mabasa, chirimwa, saizi, kuderedza uremu, shandura fomati, sanganisa mifananidzo, nezvimwe, nezvimwe. Kana iwe uchida kuziva zvakawanda enda kune yayo yepamutemo webhusaiti.

Iyo inoshanda sei

Premiere GituHub ne script iyi. Handisati ndadzidza mashandisiro azvo zvakanaka.

watermark script faira chimiro

Iyo sisitimu yandakagadzira ine 1 faira, 1 mufananidzo uye 2 maforodha.

The folda mifananidzo ndipo pandinoisa mifananidzo yandinoda kuwedzera watermark. Y mune folda Output ndipo padzinooneka dzakatopepetwa.

watermark-ikkarocom.png ndiyo watermark yandinoshandisa

archive

Uye pakupedzisira pane .sh file watermark.sh inova iyo ine code muBASH

Kana usina chokwadi chekuti chii uye kuti woshanda sei ne .sh, heino pekutangira Maitiro ekumhanyisa .sh faira

Tsananguro yekodhi nhanho nhanho.

Nzira iri nyore yekudzidza BASH programming ndeyekutarisa mienzaniso yeakagadzirira-akagadzirwa zvinyorwa uye zvirongwa. Iyi ndiyo kodhi yandinoshandisa.

#!/bin/bash

cd photos
for pic in *; do
    composite -dissolve 90% -gravity southeast -geometry +40+30 ../watermark-ikkarocom.png $pic ${pic//.jpg}-marked.jpg
done
mv *-marked.jpg ../output
rm *

Kurerutsa kunzwisisa ndinoitsanangura nemitsara.

#!/bin/bash

Ndiyo shebang, iyo inoshandiswa kuratidza muturikiri kuti ashandise kodhi.

cd photos

Isu tinopinda folda mifananidzo, kwatichange tasiya mafoto atinoda kuwedzera watermark. Maitiro aya anogona zvakare kuve otomatiki nekutumira iwo mapikicha zvakananga kune folda kubva kune mobile. Asi ndinosiira mberi.

for pic in *; do

Kutanga kweiyo loop, kwatinoudza kuti kune ese mafoto ari mufolda, unofanirwa kuita mirairo inotevera.

composite -dissolve 90% -gravity southeast -geometry +40+30 ../watermark-ikkarocom.png $pic ${pic//.jpg}-marked.jpg

Icho chikamu che ImageMagick. Tiri kutaura kuti kumifananidzo iri mufolda tinowedzera imwe pamusoro, munyaya iyi "watermark-ikkarocom.png" nekujeka pa90% kana 10% zvichienderana nekuti unoda kutarisa sei. Inowanikwa kumaodzanyemba kwakadziva kumabvazuva kwemufananidzo, ndiko kuti, pasi kurudyi uye nemiganhu kana kupatsanurwa kwe40 uye 30 px maererano nemufananidzo wekumashure.

Pamusoro pezita remifananidzo, wedzera suffix -marked. Kuti tikwanise kuasiyanisa kubva kune atisina kugadzirisa.

Pano tinogona kuwedzera mimwe mirairo nekugadzirisa mufananidzo, kuderedza uremu kana kuimanikidza.

Iwe unogona kushandisa zita re watermark yaunoda nekushandura watermark-ikarocom.png

done

inotara panoperera loop

mv *-marked.jpg ../output

Mifananidzo yakaramba iri mufodhi yemifananidzo, saka nemutsara uyu tinokuudza kuti utore mifananidzo yose neiyo suffix -marked.jpg uye uende nayo kune inobuda folda. Shandisa nzira yakabatana. Iyo ../ ndeyekukwira kubva mudhairekitori kuenda kunowanikwa zvinobuda wozopinda mukati.

rm *

Pakupedzisira, sezvo tatova nemapikicha edu mune zvakabuda, tinodzima ese .jpg mafaera ari mumifananidzo.

Kusimudzirwa

Ndichiita chinyorwa ndakaona kuvandudzwa kwakati wandei.

  • Ndinogara ndichichengeta mu .jpg format kunyange zvazvo mufananidzo wekuisa uri .png, izvi zvinogona kuva dambudziko kana mufananidzo wekutanga ukaita pachena.

Kana iwe uri munhu asingazorore sesu uye uchida kushandira pamwe mukuchengetedza nekuvandudza chirongwa, unogona kupa mupiro. Mari yese ichaenda kunotenga mabhuku nezvinhu zvekuyedza nekuita tutorials

Leave mhinduro