SimpsoN_Bart Posted April 2, 2011 Share Posted April 2, 2011 Arkadaşlar Benim bir kaç sorum olacaktı.Şimdi butona bastığımzda fileopen dialog la açtığımız resimleri guictrlcreatepic yardımıyla gui de gösterecek yani önizleme yapacak. Sonra sectiğimiz resmi inputa girdiğimiz x ve y değerler doğrultsunda resmi boyutlandırcak..Boyutlandırdık tan sonra tekrar resmi önizleme yaptıracak ve butona bastığımzda resmi kayıt edecek.Birde resmi yazdırmak istiyorum ama nasıl yapacağım hakkında bilgim yok Bişeler karaladım ama resim güzel olmuyor kalitesi düşüyor onun için bi dll var phototoys.dll onu kullanıp bu işlemleri yaptırsak daha iyi olur sanırım..Ama dll yi nasıl kullanacamı bilmiyorum..Yani kısaca resmi yeniden boyutlandırma programı yapmak istiyorum yardımlarınız için şimdiden saolun .) Quote Link to comment Share on other sites More sharing options...
blackman12 Posted April 2, 2011 Share Posted April 2, 2011 [code]#include <GDIPLUS.au3> Global $b = True $resimsec = FileOpenDialog("Resim Seç",@DesktopDir,"Images (*.jpg;*.bmp)",1) if not @error Then $resim = _GetWHI($resimsec) $x = $resim[0] $y = $resim[1] If @DesktopWidth < $resim[0] Then $x = @DesktopWidth-10 If @DesktopHeight < $resim[1] Then $y = @DesktopHeight-60 $gui1 =GUICreate("Resim Önizleme",$x,$y) GUICtrlCreatePic($resimsec,0,0,$x,$y) GUISetState() While $b = True $sor = InputBox("Yeni boyutu girin","Resmi yeniden boyutlandırmak için yeni boyutu girin: "&@CRLF&"Örnek: '500x600' 500 genişlik 600 yükseklik","100x100") if not @error Then $yeni = StringSplit($sor,"x") if $yeni[0] <> 2 Then MsgBox(16,"Hata!","Yanlış bir boyutlandırma girdiniz!") elseif Number($yeni[1]) = 0 or Number($yeni[2]) = 0 Then MsgBox(16,"Hata!","Sadece rakam girişi yapın!"&$yeni[1]&$yeni[2]) Else $b = False GUIDelete($gui1) $gui2 =GUICreate("Resim Önizleme",$yeni[1],$yeni[2]+40) GUICtrlCreatePic($resimsec,0,0,$yeni[1],$yeni[2]) $kaydey = GUICtrlCreateButton("Kaydet",($yeni[1]-40)/2,$yeni[2]+10) GUISetState() While 1 if GUIGetMsg() = -3 then Exit if GUIGetMsg() = $kaydey Then _ImageResize($resimsec, $resimsec, Number($yeni[1]), Number($yeni[2])) Exit EndIf WEnd EndIf Else Exit EndIf if GUIGetMsg() = -3 then Exit WEnd EndIf Func _GetWHI($sImage) Local $hImage, $aRet[2] _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sImage) $aRet[0] = _GDIPlus_ImageGetWidth($hImage) $aRet[1] = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Return $aRet EndFunc Func _ImageResize($sInImage, $sOutImage, $iW, $iH) Local $sOP, $sOF, $sInExt, $Ext, $hBitmap, $hImage1, $hImage2, $hGraphic, $CLSID, $i = 0 Local $sType = "BMP|GIF|ICO|JPG|JPEG|PNG|TIF|TIFF" If Not FileExists($sInImage) Then Return SetError(1, 0, 0) $sInExt = StringUpper(StringTrimLeft($sInImage, StringInStr($sInImage, ".", 0, -1))) If Not StringRegExp($sInExt, "\A(" & $sType & ")\z", 0) Then Return SetError(2, 0, 0) $sOP = StringLeft($sOutImage, StringInStr($sOutImage, "\", 0, -1)) If Not FileExists($sOP) Then Return SetError(3, 0, 0) $sOF = StringTrimLeft($sOutImage, StringInStr($sOutImage, "\", 0, -1)) $Ext = StringUpper(StringTrimLeft($sOutImage, StringInStr($sOutImage, ".", 0, -1))) If Not StringRegExp($Ext, "\A(" & $sType & ")\z", 0) Or $Ext = "ICO" Then Return SetError(4, 0, 0) If Not IsInt($iW) And Not IsInt($iH) Then Return SetError(5, 0, 0) $hBitmap = _WinAPI_CreateBitmap($iW, $iH, 1, 32) _GDIPlus_Startup() $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hImage2 = _GDIPlus_ImageLoadFromFile($sInImage) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $iW, $iH) $CLSID = _GDIPlus_EncodersGetCLSID($Ext) Do $i += 1 Until (Not FileExists($sOP & $i & "_" & $sOF)) $sOutImage = $sOP & $i & "_" & $sOF _GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID) _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() Return SetError(0, 0, 1) EndFunc ;==>_ImageResize [/code] Quote Link to comment Share on other sites More sharing options...
SimpsoN_Bart Posted April 2, 2011 Author Share Posted April 2, 2011 (edited) yardımınız için teşkkür ederim mantığını anladım geliştirim bunu aklım da güzel şeyler var tekrar saolun Edited April 11, 2011 by SimpsoN_Bart Quote Link to comment Share on other sites More sharing options...
SimpsoN_Bart Posted April 2, 2011 Author Share Posted April 2, 2011 (edited) Birde Birşey sorcam @blacman12 hocam buttona bastığımzda resmi nasıl yazdırabilirz ? Onuda yazarsanız sevinirim Edited April 2, 2011 by SimpsoN_Bart Quote Link to comment Share on other sites More sharing options...
blackman12 Posted April 2, 2011 Share Posted April 2, 2011 shellexecute("print "&$resimsec) şeklinde yapabilirsin yada _fileprint komutunu kullanabilirsin. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.