Hallo, wie kann man von einer bestehenden Bitmapdatei (BMP) die Auflösung auslesen. (Ähnlich Rechtsklick->Eigenschaften->
Dateiinfo->Erweitert)
Danke
igillan
Aulösung eines Bitmaps auslesen
-
- [ gelöst ]
-
igillan -
8. Februar 2007 um 21:55 -
Geschlossen -
Erledigt
-
-
- Offizieller Beitrag
Hi,
Spoiler anzeigen
[autoit];===============================================================================
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
; Function Name: GetExtProperty($sPath,$iProp)
; Description: Returns an extended property of a given file.
; Parameter(s): $sPath - The path to the file you are attempting to retrieve an extended property from.
; $iProp - The numerical value for the property you want returned. If $iProp is is set
; to -1 then all properties will be returned in a 1 dimensional array in their corresponding order.
; The properties are as follows:
; Name = 0
; Size = 1
; Type = 2
; DateModified = 3
; DateCreated = 4
; DateAccessed = 5
; Attributes = 6
; Status = 7
; Owner = 8
; Author = 9
; Title = 10
; Subject = 11
; Category = 12
; Pages = 13
; Comments = 14
; Copyright = 15
; Artist = 16
; AlbumTitle = 17
; Year = 18
; TrackNumber = 19
; Genre = 20
; Duration = 21
; BitRate = 22
; Protected = 23
; CameraModel = 24
; DatePictureTaken = 25
; Dimensions = 26
; Width = 27
; Height = 28
; Company = 30
; Description = 31
; FileVersion = 32
; ProductName = 33
; ProductVersion = 34
; Requirement(s): File specified in $spath must exist.
; Return Value(s): On Success - The extended file property, or if $iProp = -1 then an array with all properties
; On Failure - 0, @Error - 1 (If file does not exist)
; Author(s): Simucal ([email='Simucal@gmail.com'][/email])
; Note(s):
;
;===============================================================================#include <array.au3>
[/autoit] [autoit][/autoit] [autoit]
$path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)")
$prop = _GetExtProperty($path,-1)
_ArrayDisplay($prop,"Property Array")Func _GetExtProperty($sPath, $iProp)
[/autoit]
Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
$iExist = FileExists($sPath)
If $iExist = 0 Then
SetError(1)
Return 0
Else
$sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
$sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
$oShellApp = ObjCreate ("shell.application")
$oDir = $oShellApp.NameSpace ($sDir)
$oFile = $oDir.Parsename ($sFile)
If $iProp = -1 Then
Local $aProperty[35]
For $i = 0 To 34
$aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
Next
Return $aProperty
Else
$sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
If $sProperty = "" Then
Return 0
Else
Return $sProperty
EndIf
EndIf
EndIf
EndFunc ;==>_GetExtPropertySo long,
Mega
-
Danke funzt prima!
igillan -
- Offizieller Beitrag
HI,
gern geschehen. Endlich mal eine klare Anforderung die ohne Nachfrage, was derjenige eigentlich will beantwortet werden konnte!
Lob&Anerkennung!
So long,
Mega
-
Hallo, ich noch mal. Es gibt doch noch ein kleines Problem. Und zwar wenn ich das Skript auf meinem Rechner an der Arbeit laufen lasse, werden die vertikalen und horizontalen Koordinaten in Feld 30 bzw. 31 des Arrays gespeichert. Frage ich die gleiche Datei auf meinem PC zu Hause ab, ist es Feld 27 und 28.
Kann man das irgendwie beheben?
Danke igillanAch ja, auf dem einem Rechner ist XPprof und auf dem anderen XPhome.
-
- Offizieller Beitrag
Hi,
ich kann es im Moment nicht nachstellen, da ich nur XP Prof. hier habe, aber du kannst natürlich eine If then else bauen mit @OSVersion = ...
So long,
Mega
-
Zitat
kannst natürlich eine If then else bauen mit @OSVersion = ...
... falls das unterschiedliche Betriebssystem der Grund ist. Wenn ja, so ist es ja fast unmöglich diese Methode zu nutzen, da ich ja nicht jedes einzelne BS testen kann. Mit dem Skript sollen automatisch Karten für ein GPS-Handy generiert werden. Die Karten liegen im BMP-Format vor.
Es muß nun die Auflösung ausgelesen werden damit eine Kalibrierungsdatei geschrieben werden kann. Diese enthält dann die 4 Eckpunkte der Karte (0,0 xmax,0 xmax,ymax 0,ymax ) und die dazugehörigen Koordinaten.
Vielleicht gibt es noch eine andere Möglichkeit bzw. ein feste Zuordnung der Felder.
Gruß igillan...oder vielleicht so:
For $n = 0 To 34
if StringInStr ( $prop[$n], "Pixel") > 0 Then
$pixelhorizontal=StringTrimRight($prop[$n], 6)
$pixelvertikal=StringTrimRight($prop[$n+1], 6)
ExitLoop
EndIf
Next