Jump to content

Decreasing Image resolution..


Recommended Posts

Hi! ol...

i just needed a code for decreasing resolution i.e making a thumbnail of an image...with same quality

and of same extension...if the original image is png then the thumb should also be a png image..

:blink:

plz help...

[font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font]

Link to comment
Share on other sites

@endfunc thnks for ur reply ..i knw that it can be done by GDI library but i know nothing about image processing so..it is very difficult for me..to understand..

Edited by Piyush

[font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font]

Link to comment
Share on other sites

Here is a function for you:

Func _imageResize($oldImage, $newImage, $newW, $newH, $startGdiP = True)
    If $startGdiP Then _GDIPlus_Startup()

    $img =      _GDIPlus_ImageLoadFromFile($oldImage)
    $gContext = _GDIPlus_ImageGetGraphicsContext($img)

    $newBmp =   _GDIPlus_BitmapCreateFromGraphics($newW, $newH, $gContext)
    $gNewContext = _GDIPlus_ImageGetGraphicsContext($newBmp)

    _GDIPlus_GraphicsDrawImageRect($gNewContext, $img, 0, 0, $newW, $newH)

    _GDIPlus_ImageSaveToFile($newBmp, $newImage)

    _GDIPlus_ImageDispose($img)
    _GDIPlus_GraphicsDispose($gContext)
    _GDIPlus_GraphicsDispose($gNewContext)
    _GDIPlus_BitmapDispose($newBmp)

    If $startGdiP Then _GDIPlus_Shutdown()
EndFunc  ;==>_ImageResize
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...