Page 1 sur 1
[R] Résolution d’une image
Posté : dim. 31 oct. 2010 19:04
par moustache
Bonjour, je viens de cherchez 2 jours entier une fonction ou une potentiel UDF qui permettrai de modifier la résolution d’une image. Je ne parle pas de la taille d’une image mais de la résolution ppp quand on scanne quelque chose avec un scanneur par exemple.
Voici en image la résolution que je veux modifier. Le screen est fait sur GIMP. J'ai fait ce screen pour être bien sur d'êtres compris.
http://img10.hostingpics.net/pics/635146a.jpg
PS : J'aimerais que la resolution soit en pixel par pousse.
Es que ont peut faire sa avec Autoit et commant ?
Re: [..] Résolution d’une image
Posté : mer. 03 nov. 2010 04:03
par bloodwolff
Voilà une fonction qui pourrait t'aider
► Afficher le texte
Code : Tout sélectionner
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_BitmapSetResolution
; Description ...: Sets the resolution of this Bitmap object
; Syntax.........: _GDIPlus_BitmapSetResolution($hBitmap, $nDpiX, $nDpiY)
; Parameters ....: $hBitmap - Pointer to the Bitmap object
; $nDpiX - Value that specifies the horizontal resolution in dots per inch.
; $nDpiX - Value that specifies the vertical resolution in dots per inch.
; Return values .: Success - True
; Failure - False and either:
; |@error and @extended are set if DllCall failed
; |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: None
; Related .......:
; Link ..........; @@MsdnLink@@ GdipBitmapSetResolution
; Example .......; Yes
; ===============================================================================================================================
Func _GDIPlus_BitmapSetResolution($hBitmap, $nDpiX, $nDpiY)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapSetResolution", "hwnd", $hBitmap, "float", $nDpiX, "float", $nDpiY)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_BitmapSetResolution
Ainsi qu'un exemple de son utilisation
► Afficher le texte
Code : Tout sélectionner
#include <ScreenCapture.au3>
Local $hBmp, $hBitmap
; Initialize GDI+
_GDIPlus_Startup()
$hBmp = _ScreenCapture_Capture("", 0, 0, -1, -1, False)
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
; Set Dots Per Inch to 96x144, usually 96x96 or 120x120: isotropic
_GDIPlus_BitmapSetResolution($hBitmap, 320, 320)
_GDIPlus_ImageSaveToFile($hBitmap, @MyDocumentsDir & "\96x144.jpg")
; Clean up
_GDIPlus_ImageDispose($hBitmap)
_WinAPI_DeleteObject($hBmp)
; Uninitialize GDI+
_GDIPlus_Shutdown()
ShellExecute(@MyDocumentsDir & "\96x144.jpg")
Func _GDIPlus_BitmapSetResolution($hBitmap, $nDpiX, $nDpiY)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapSetResolution", "hwnd", $hBitmap, "float", $nDpiX, "float", $nDpiY)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_BitmapSetResolution
Re: [..] Résolution d’une image
Posté : mer. 03 nov. 2010 08:00
par Tlem
@bloodwolff
Un lien vers la source aurait été apprécié.
http://www.autoitscript.com/forum/index ... t&p=748870
Re: [..] Résolution d’une image
Posté : mer. 03 nov. 2010 12:51
par bloodwolff
Que je te donne du travail TLem
Voilà ma vrai source
http://www.autoitscript.com/forum/index ... =834892&hl
Avec le temps je vais devenir plus autonome promis

Re: [..] Résolution d’une image
Posté : dim. 07 nov. 2010 01:54
par bloodwolff
Le problème n'est pas résolu ? Sinon merci de préciser ce qu'il manque
Re: [..] Résolution d’une image
Posté : dim. 07 nov. 2010 10:34
par moustache
Merci de ta réponsse bloodwolff, sa fonctionne le problèmme est résolut.