Jump to content

DivaneTR
 Share

Recommended Posts

_ImageResize fonksiyonunu birçok kişi bilir. Fonksiyonu geliştirerek, belirtilen dosyayı belirtilen boyuta indirgemek için ek bir fonksiyon yazdım. Maximum dosya boyutu koşulu sunan servisler için kullanılması amaçlanarak yazılmıştır. Örneğin Windows logon ekranı için en fazla 245KB boyutunda bir grafik koyabilirsiniz. Bu gibi durumlarda bu fonksiyon işimize yaramaktadır. Fonksiyon belirttiğiniz resim dosyasını en*boy oranını koruyarak adım adım küçültür, ta ki istediğimiz boyuta gelene kadar.

 

Fonksiyon;

Func _ResizeToSize($Input, $Output, $ToSize)
	$Temp = _TempFile(@TempDir & "\", "", ".jpg")
	FileCopy($Input, $Temp, 9)
	$Size = FileGetSize($Temp)
	$Boyutlar = _GetWHI($File)
	While $Size >= $ToSize
		_ImageResize($Input, $Temp, Floor($Boyutlar[0] / 1.05), Floor($Boyutlar[1] / 1.05))
		$Boyutlar = _GetWHI($Temp)
		$Size = FileGetSize($Temp)
	WEnd
	FileMove($Temp, $Output, 9)
EndFunc   ;==>_ResizeToSize
Parametreler;
$Input = İşlenecek dosyanın tam yolu (Örn : C:\deneme.jpg)
$Output = İşlem sonrası kaydedilecek dosya (Örn : C:\deneme_resized.jpg)
$ToSize = Kilobyte cinsinden belirleyeceğiniz dosya boyutu (Örn : 250)

Gerekli Diğer Fonksiyonlar ;

Func _GetWHI($sImage)
	Local $HIMAGE, $aRet[3]
	_GDIPlus_Startup()
	$HIMAGE = _GDIPlus_ImageLoadFromFile($sImage)
	$aRet[0] = _GDIPlus_ImageGetWidth($HIMAGE)
	$aRet[1] = _GDIPlus_ImageGetHeight($HIMAGE)
	$aRet[2] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($HIMAGE)
	_GDIPlus_ImageDispose($HIMAGE)
	_GDIPlus_Shutdown()
	Return $aRet
EndFunc   ;==>_GetWHI

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_GraphicsSetInterpolationMode($hGraphic, 2)
	_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $iW, $iH)
	$CLSID = _GDIPlus_EncodersGetCLSID($Ext)
	Do
		$i += 1
	Until (Not FileExists($sOP & $i & "_" & $sOF))
	$sOutImage = $sOP & $sOF
	_GDIPlus_GraphicsSetInterpolationMode($hImage1, 2)
	_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

Örnek Kullanım ;

$File = @DesktopDir & "\test.jpg" ; full path of file to resize
$MaxSize = 250 ; as kilobyte
If FileExists($File) And IsNumber($MaxSize) Then
$tim = TimerInit()
_ResizeToSize($File, @DesktopDir & "\resized.jpg", $MaxSize*1024)
MsgBox(64, "Geçen süre", Floor(TimerDiff($tim)) / (1000) & " saniye")
Else
	MsgBox(48,"","hata")
EndIf

:download1:

[attachment=1277:ResizeToSize.zip]

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Similar Content

    • By qxqx
      FastStone Image Viewer v7.7 Multilingual

       
      FastStone Image Viewer is a fast, stable, user-friendly image browser, converter and editor. It has a nice array of features that include image viewing, management, comparison, red-eye removal, emailing, resizing, cropping and color adjustments. Its innovative but intuitive full-screen mode provides quick access to EXIF information, thumbnail browser and major functionalities via hidden toolbars that pop up when your mouse touches the four edges of the screen. Other features include a high quality magnifier and a musical slideshow with 150+ transitional effects, as well as lossless JPEG transitions, drop shadow effects, image annotation, scanner support, histogram and much more.
        FastStone Image Viewer supports all major graphic formats (BMP, JPEG, JPEG 2000, animated GIF, PNG, PCX, TIFF, WMF, ICO and TGA) and popular digital camera RAW formats (CRW, CR2, NEF, PEF, RAF, MRW, ORF, SRF and DNG).

       
      Features of FastStone Image Viewer Portable
      Image browser and viewer with a familiar Windows Explorer-like user interface Support of many popular image formats: BMP, JPEG, JPEG 2000, animated GIF, PNG, PCX, TIFF, WMF, ICO and TGA and popular digital camera RAW formats (CRW, CR2, NEF, PEF, RAF, MRW, ORF, SRF and DNG). True Full Screen viewer with image zoom support and unique fly-out menu panels Crystal-clear and customizable one-click image magnifier Superior Red-Eye effect removal/reduction with completely natural looking end result Image modification tools: Resize/resample, rotate/flip, crop, sharpen/blur, brightness/contrast, etc. Eleven (yes, 11) resampling algorithms to choose from when resizing images Image color effects: gray scale, sepia, negative, Red/Green/Blue adjustment Image special effects: watermark, annotation, drop shadow, framing, bump map, lens, morph, waves Multi-level Undo/Redo capability One-touch best fit/actual size image display support Image management, including tagging capability, with drag-and-drop and Copy To/Move To Folder support Histogram display with color counter feature Compare images side-by-side (up to 4 at a time) to easily cull those forgettable shots Image EXIF metadata support (plus comment editing for JPEGs) Configurable batch processing to convert/rename large or small collections of images Slideshow creation with 150+ transition effects and music support (MP3, WMA, WAV…) Create efficient image attachment(s) for emailing to family and friends Print images with full page-layout control Create fully configurable Contact Sheets – just like the pros (and save $$$ on ink) Create memorable artistic image montages from your family photos for personalized desktop wallpapers (Wallpaper Anywhere) FastStone Image Viewer acquires images from a scanner Versatile screen capture capability Powerful Save As interface to compare image quality and control generated file size Run favorite programs with one keystroke from within Image Viewer Create a no-install fully portable version of the program which can be run from a removable storage device Configurable mouse wheel support Supports multiple program skins Supports dual-monitor configurations And much more… FastStone Image Viewer v7.7 Multilingual
      Title: FastStone Image Viewer Corporate v7.7
      Developer: Home Page
      License: Shareware
      Language: Multilingual
      OS: Windows
      TEAM-Full
      FastStone Image Viewer v7.7 Multilingual TEAM-Full.exe (10.95 MB)
    • By qxqx
      R-Drive Image v7.0.7005 Multilingual

      R-Drive Image v7.0.7005 Multilingual
       
      R-Drive Image, yedekleme veya çoğaltma amacıyla disk görüntüsü dosyaları oluşturma olanağı sağlayan güçlü bir yardımcı programdır.   Disk görüntüsü dosyası, bir sabit sürücünün tam, bayt bayt kopyasını içerir,   bölüm veya mantıksal disk ve Windows işletim sistemini durdurmadan ve dolayısıyla işinizi kesintiye uğratmadan anında çeşitli sıkıştırma düzeyleriyle oluşturulabilir.   Bu sürücü görüntü dosyaları daha sonra CD-R (W) \/ DVD, Iomega Zip veya Jazz diskleri gibi çeşitli çıkarılabilir ortamlar da dahil olmak üzere çeşitli yerlerde saklanabilir.   R-Drive Image, görüntüleri orijinal disklere, diğer bölümlere ve hatta bir sabit sürücünün boş alanına anında geri yükler.   Sistemi ve diğer kilitli bölümleri geri yüklemek için R-Drive Görüntüsü doğrudan Windows'tan sahte grafik moduna geçirilir veya yardımcı program tarafından oluşturulan önyüklenebilir sürüm CD diskinden başlatılır veya Disket.   R-Drive Image is a potent utility providing disk image files creation for backup or duplication purposes. A disk image file contains the exact, byte-by-byte copy of a hard drive, partition or logical disk and can be created with various compression levels on the fly without stopping Windows OS and therefore without interrupting your business. These drive image files can then be stored in a variety of places, including various removable media such as CD-R(W)/DVD, Iomega Zip or Jazz disks, etc.
      R-Drive Image restores the images on the original disks, on any other partitions or even on a hard drive’s free space on the fly. To restore system and other locked partitions R-Drive Image is switched to the pseudo-graphic mode directly from Windows or bootable version created by the utility is launched from CD disc or diskettes.
      Features of R-Drive Image Full Download
      A simple wizard interface – no in-depth computer management skills are required. Commands in the shortcut menu to perform some disk actions, like restoring data from an image file and connecting an image as a virtual disk directly from Windows explorer. Image files are created on-the-fly, no need to stop and restart Windows. All other disk writes are stored in a cache until the image is created. Images can be created for storage devices with removable media Images can be burned on CD/DVD recorders directly from the program Image data can be compressed to save free space. Image files can be stored on removable media. Support for USB 2.0 devices in the startup mode. Images can be split into several files to fit the type of the storage medium. Image can be created incrementally and differentially. Image files can be password-protected and contain comments. Title: R-Drive Image v7.0 Build 7005
      Developer: R-tools technology Inc.
      License: Shareware
      Language: Multilingual
      OS: Windows
      R-Drive Image v7.0.7005 Multilingual TEAM-Full
      EXE
      CRC32: 3063F4A4
      MD5: 2D09999A00F3E427D693970CEE47B2D4
      SHA-1: E70A1BCDD2932E2AA65B762EE7301350A9B255D1
      R-Drive Image v7.0.7005 Multilingual TEAM-Full
      Download Full (92.33 MB)
      Mirrorace.org
       
       
    • By artae
      File Size: 319 Mb

      Image for Windows provides an easy and convenient way to completely backup all your hard drive's data, programs and operating systems.

      Your backups can be saved directly to external USB and FireWire drives, to internal or network drives, and even directly to CD, DVD, or BD. The suite includes an easy-to-use MakeDisk wizard for creating a recovery boot disk. To restore your data, programs and operating systems back to the way they were when the backup was created, simply boot the recovery disk and restore the partition(s) or drive(s) you need to recover. It's that easy.

      As a key component of the TeraByte Drive Image Backup and Restore Suite, Image for Windows utilizes the technology provided by Volume Shadow Copy Service (VSS) or PHYLock, an add-on component included in the suite. VSS and PHYLock allows you to continue using your computer while the backup is locked to a point-in-. This eliminates the inconsistencies typically experienced while backing up a partition that is in use.

      Image for Windows runs under the Windows operating system, yet it can backup or restore any partition, including those of DOS or Linux, and even partitions encrypted by third-party software.

      The TeraByte drive image files produced by Image for Windows are compatible across all TeraByte Unlimited disk imaging products of the same major version number (i.e. all 3.x products are compatible with other 3.x products). This gives you the flexibility to restore disk images using your component of choice.

      The TeraByte Drive Image Backup and Restore Suite includes Image for Windows, Image for Linux, Image for DOS, and the OSD Tool Suite. Image for DOS and Image for Linux support the same powerful drive image functionality without requiring a working Windows installation.

      Bonus
      The TeraByte OS Deployment Tool Suite (TBOSDTS) Pro version contains a set of powerful scripts that, among other things, will help you deploy Windows to completely different hardware.

      Image for Windows Features

      Total Reliability
      Provides the option to verify each and every byte it backs up.

      Convenience
      Runs directly from Windows and when used with the free PHYLock add-on, it can create a true image of the Windows partition itself, without requiring a reboot.

      Security
      Your backups can be secured using simple password protection, or full 256-bit AES encryption.

      Backup Changed Data
      Change only backup option allows you to backup only data that has changed since the last backup was created.

      Simple, Wizard-Driven interface
      Easy to use the first , and every .

      Compression
      Speed or size, several reliable compression options are available.

      Maximum Speed
      Fast, yet reliable techniques are used to create the backups quickly.

      Optical Drive Support
      You can save directly to a CD, DVD, DVD-DL, BD.

      Bootable Rescue Discs
      Whenever you save directly to a CD, DVD, DVD-DL, BD, it will automatically become a bootable restore disc.

      Large drive support
      GPT compatible supporting drives larger than 2TiB.

      Restore Individual Files or Folders
      Using the free TBIView and TBIMount add-ons, you can view the contents of the drive image files, and optionally restore individual files or folders within them.

      Compatibility
      Automatically recognizes and backs up used area of FAT16, FAT32, NTFS, HFS+, Ext2, Ext3, Ext4, ReiserFS, and XFS partitions. It also recognizes and backs up used areas of ReFS and exFAT partitions using Windows support. Partitions with other file system types can be backed up in their entirety. Supports all standard partitions in an MBR, EMBR, or GPT

      Windows Servers
      Supports both Workstation and Server versions of Windows.

      Multicasting
      Supports multicasting to reduce network traffic when deploying multiple Workstations.

      Cost Effectiveness
      Includes Image for DOS, Image for Linux, and TBOSDT at no additional charge, making it a uniquely affordable and complete disk imaging solution.

      Flexibility
      Restore partitions, regardless of the file system on the partition being restored. This gives you the power to restore NTFS partitions from Windows 98 or even DOS (as just a couple of examples).

      Wide-Rag Device Support
      Compatible with NVMe, SAS, SCSI, PATA, SATA, USB, IEEE 1394, and more.

      Power
      Using Image for DOS or Image for Linux (each of which is included with the purchase of Image for Windows) versions gives you the ability to recover your data, even if Windows won't start.

      Network Support
      Save backups to any drive accessible to Windows itself.

      RAID Support
      Works seamlessly with on-board hardware- and firmware-based RAID.

      Command Line Support
      Powerful, complete command line support is built in, allowing you to automate backup or restore procedures.

      Scheduling
      Leverages the built-in Windows scheduler via the simple click of a Schedule Backup button.

      Image File Validation
      Allows you to thoroughly check the integrity of the disk image files, either as part of the backup process, or at any thereafter. TeraByte imaging products are renown for their thorough and accurate validation process.

      Restored Partition Expansion
      When restoring an image, you can expand the restored partition to occupy any free space that would be left over.

      Selectable Image File Sizes
      If desired, you can specify a maximum size for the disk image files that are created. This allows you to create image files that readily fit on the removable media of your choice.

      Hardware Independent Restore
      Restore Windows to completely different hardware and then use the TeraByte OSD Tool Suite to install the drivers required to support the new hardware.

      Physical to Virtual
      Scripts included to automatically convert your physical machine to a virtual machine, either directly or from a backup image.

      Virtual to Physical
      Convert your virtual machine to a physical machine using the included scripts.

      System Requirements
      - Compatible with Windows x86 and Windows x64 versions.
      - Compatible with Windows NT4, 2000, XP, Vista, 7, 8, 10.
      - Compatible with Windows Server and SBS versions (NT4, 2000, 2003, 2008, 2008R2, 2011, etc..).

      TeraByte Drive Image Backup & Restore Suite Components
      - Image for Windows
      - Image for DOS
      - Image for Linux
      - OSD Tool Suite

      HomePage:https://anonymz.com/https://www.terabyteunlimited.com/
      DOWNLOAD
      (Buy premium account for maximum speed and resuming ability)


      https://nitroflare.com/view/EFBEB150148B429/nq77b.TeraByte.Drive.Image.Backup..Restore.Suite.3.53.Multilingual.rar



      https://rapidgator.net/file/d93bbd18ebee96c72acd31a9316bf347/nq77b.TeraByte.Drive.Image.Backup..Restore.Suite.3.53.Multilingual.rar


    • By artae
      File Size : 0.9 Mb

      USB Image Tool can create images of USB flash drives and MP3 players, that are mounted as USB drives.

      It allows you switch between images with different music styles on your MP3 Player or to make an exact backup image of your USB Stick.

      create image files of USB flash drives
      restore images of USB flash drives
      compressed image file format
      show USB device information
      manage favorite USB images
      command line utility
      DOWNLOAD
      (Buy premium account for maximum speed and resuming ability)


      https://nitroflare.com/view/2901C0FA6F042A9/8qey7.USB.Image.Tool.1.82.rar



      https://rapidgator.net/file/fbe1700ea69d116e568277b572d0d715/8qey7.USB.Image.Tool.1.82.rar


    • By artae
      Vegas Image 3.1.0.0 (x64) | 96.7 Mb
      VEGAS Image is a raw image compositor. It uses layer-based compositing to combine images in 16-bit color space. When using raw images, it accesses the full range of raw color data, providing the highest quality in the industry. And by using the GPU for the heavy lifting, performance is still astonishingly fast, even on high resolution images.
      VEGAS Image provides a full toolkit to create composite images for a range of applications, including:

      - Event photography: Easily and quickly batch process large quantities of images shot using the same setup, by applying the same settings to all images automatically.
      - Studio photography: Full control over the individual images in your composite allow you to carefully construct realistic results that cannot be shot practically.
      - Advertising campaigns: Batch processing includes controls for easily creating consistency in layout across multiple exported images in different sizes and aspect ratios. Easily add text and other graphics to your composites using the built-in tools.
      - Catalogs: Green screen photography makes it simple to replace backdrops behind your models or products, to add imagery that enhances the products being sold.
      and much more.
      Batch and workflow features:
      - Layer content: A fundamental feature of the VEGAS Image workflow is that layers exist as containers, and each layer can contain multiple images. So when working with a batch of images, you can set up a single layer the way you want, and import the entire batch of images into it. Multiple layers can be used to set up different elements, or to process groups of images from the batch using different settings.
      - Custom export list: In addition to easily auto-exporting all images in your project, you can easily set up custom export lists, to only export specific images, or specific variations of the layers stored in the project.
      - Content variations: Creating variations of images based on layer content is also possible. For example, you may have one layer for your background, which contains three different background images. A second layer might contain 5 foreground images. It is a simple process to export each foreground three times, once with each background, for a total of 15 image variations. Those numbers aren't limitations, each layer could contain one image or hundreds.
      System Requirements:Microsoft Windows 11 (64-bit), Microsoft Windows 10 (64-bit), Microsoft Windows 8 (64-bit)
      Home Page -https://www.vegascreativesoftware.com/
      DOWNLOAD
      (Buy premium account for maximum speed and resuming ability)


      https://nitroflare.com/view/6291CEBDA34F907/rv9d9.Vegas.Image.3.1.0.0.x64.rar



      https://rapidgator.net/file/b6629d45c9595c8584330968bc0a6c63/rv9d9.Vegas.Image.3.1.0.0.x64.rar


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...