AntiGuide: BmpBoutABout



PagePrincipale :: DerniersChangements :: ParametresUtilisateur :: Vous êtes 216.73.216.115 :: Signaler un abus :: le: 20250623 13:24:44
.. Juxtaposer2Images
20131020 : en cours

appel: bmpy2.vbs haut bas totale

pour mise côte à côte: pivoter les images de 90 °, assembler, puis pivoter encore!

Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

np="bmpy2"
set oArgs=WScript.Arguments ' tableau d'arguments
if oArgs.Count<>3 then 
   msgbox "Appel: " & np & " image_haut image_bas grande_image"
   wscript.quit
end if

'chantier=oArgs(0)


'juxtaposition de deux images de mêmes dimensions
dim f1
dim f2
dim fo
dim nx
dim ny
dim acopier

tot=""  ' message final
dim lu  ' compteur progression dans en-tete
lu=0

dim dep ' posiiton dernière valeur lue

set f1=fso.opentextfile (oArgs(0) )
set f2=fso.opentextfile (oargs(1) )
set fo=fso.createtextfile (oargs(2),true )

addtot "lecture de " & command
addtot "décodage des 54 premiers octets"
bm =rc(2)
w bm
addtot "0: BM=" & bm

lon=i4
lonx2=lon*2-54
addtot dep & ": lon lue =" & lon
wi4 lonx2
addtot dep & ": lon écrite =" & lon
' msgbox lon
z4=i4
addtot dep & ": z4=" & z4
wi4 z4
odeb=i4
addtot dep & ": offset=" & odeb
wi4 odeb
x28=i4

addtot dep & ": 28=" & x28
wi4 x28
nx=i4
addtot dep & ": nx=" & nx
wi4 nx

ny=i4
addtot dep & ": ny=" & ny
wi4 ny*2

dep=lu
ign1=rc(1)
w ign1

addtot dep & ": ign1=" & asc(ign1)
dep=lu
ign1=rc(1)

w ign1

addtot dep & ": ign1=" & asc(ign1)


nbits=i4
addtot dep & ": nbits=" & nbits
wi4 nbits
dep=lu
ign1=rc(1)
w ign1

addtot dep & ": ign1=" & asc(ign1)
dep=lu
ign1=rc(1)
w ign1
addtot dep & ": ign1=" & asc(ign1)

taille=i4
addtot dep & ": taille(lue dans en tete)=" & taille
addtot dep & ": taille(écrite)=" & taille*2
wi4 taille*2

nx3=nx*3
' équarir
nx4=(nx3+3)\4
padi=4*nx4-nx3
acopier=nx*3+padi
addtot "acopier " & acopier

c4=i4
addtot dep & ": c4=" & c4
wi4 c4

c41=i4
addtot dep & ": c41=" & c4
wi4 c41

z4=i4
addtot dep & ": z4=" & z4
wi4 z4

z4=i4
addtot dep & " dernier i4 lu : 2x2=" & z4
wi4 z4

addtot "--- lu  " & lu 
addtot "padli=" & padi
addtot "lonli=" & padi+3*nx

addtot "--- copie et vérification de la taille du fichier"
'
' image

image f1
image f2


abandon "happy end."
' fini


sub image (f)
for li= 1 to ny

xx=f.read(acopier)

pu=pu+acopier

fo.write xx

next 'li


if f.atendofstream then
  addtot "Ok longueur réelle"
end if

end sub

sub addtot (t)
tot=tot & t & vbcrlf
end sub

function i4
dep=lu
lu=lu+4
mul=1
res=0
for i=1 to 4
un=asc(f1.read(1))
' addtot "i4 lu  " & un 
un2=asc(f2.read(1))
if un<>un2 then abandon "erreur!" & un & "<>" & un2
res=res+mul*un
mul=256*mul
next
i4=res
end function

sub wi4 (q4)
q=q4
mul=256

for i=1 to 4
res=q\256
un=q-256*res
q=res
w chr(un)
' addtot "octet " & un & " rezs= " & res
next

end sub

sub abandon (t)
addtot t
fo.close
msgbox tot
wscript.quit
end sub

sub w (q3)
fo.write q3
lw=lw+len(q3)
end sub


function rc (nb)
l1=f1.read(nb)
l2=f2.read(nb)
if l1<>l2 then abandon "différence lecture a lu=" & lu
lu=lu+nb
rc=l1
end function