Konu: GdiPlusX ile resim boyutlandırma
Daha once sorulmusmuydu yada MSN de mi bana sorulmustu hatirlamiyorum ama ihtiyaci olan arkadaslarin cok isine yarayacagini dusundugum asagidaki kodu yayinlayayim dedim. (Foxite.com bir arkadas yayinlamis). Kod daha onceden boyutlari belirtilmis sececeginiz bir image dosyasini belirttiginiz klasor ve boyutta yeniden kaydediyor. Uygulamalarda urun,personel,cari vs foto secimi ve kaydi islemlerinde cok kullanisli bir yontem.
biraz gelistirmek ve ihtiyaciniza gore resized fotonun ismi verilmesi vs size kalmis.Faydali olmasi dilegiyle...
system.app asagidaki linkten indirebilirsiniz.
Do Locfile("System.App")
With _Screen.System.Drawing
#Define cr Chr(13)
* dimensions desired for the new picture
Local lnWidth, lnHeight,size0,size1
Store 300 To lnWidth && istediginiz genislik
Store 240 To lnHeight && istediginiz yukseklik
* Load the original Image
Local loSrcImage As xfcBitmap
afile=Getpict() &&any picture
loSrcImage = .Bitmap.New(afile)
Set Compatible On
size0=Fsize(afile) &&original size in octets
* Get the thumbnail with the desired size
Local loThumbnail As xfcImage
loThumbnail = loSrcImage.GetThumbnailImage(lnWidth, lnHeight)
lcDest="c:\Resized.jpg" && kayit yeri
* Save the resized image as Png
loThumbnail.Save(lcDest, .Imaging.ImageFormat.JPEG)
size1=Fsize(lcDest)
Messagebox("Image source size (octets)="+Trans(size0)+cr+"Image resized size (octets)="+Trans(size1))
Run/N "mspaint" &lcDest &&show
Endwith
Return