'SaveThumbnail.o2bas / demo

#case capital
uses MinWin
uses ImgWin

     function SaveThumbnail(
       sys pImage=0,
       string filename="thumbnail.jpg",
       typimg="image/jpeg",
       int quality=50,
       width=100, height=100
     ) as int
  '========================================
  '
  'typimg: image/jpeg image/png image/gif image/tiff image/bmp
  'quality: 1..100
  '
  int hstatus
  sys pThumbnail 'pimage for thumbnail
  % PixelFormat24bppRGB  137224
  % PixelFormat32bppARGB 2498570
  'http://forums.purebasic.com/english/viewtopic.php?p=205981
  if pImage
    hStatus = GdipGetImageThumbnail pImage, width, height, pThumbnail, 0, 0
    SaveImage filename,typimg,quality,pThumbnail
    GdipDisposeImage pThumbnail
    function=1
  endif
  end function


#case capital
uses MinWin
uses ImgWin
GDIplus 1
sys pImage
wstring file="../images/Dawn1815.jpg"
GdipLoadImageFromFile(file,pimage)
SaveThumbnail(pimage,quality=50,width=100,height=100) 'defaults
GdipDisposeImage pImage
GDIplus 0