Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
I need to resize a jpg (basically create a large thumbnail). I have tried Pixie, but the JPG compression is way too high for the quality I need. The images need to be jpegs - not bmps - or compression would not be an issue. I also need it to be as fast as possible (there are thousands of jpgs to convert), so I thought GDI+ might be the way to go.
Has anyone tried to resize an image with GDI+?
#definefunction gpGetImageThumbnail(agp, GpImage, thumbWidth, thumbHeight) bthumbImage = binaryalloc(4) r = dllcall(agp[0], long:"GdipGetImageThumbnail", long:GpImage, long:thumbWidth, long:thumbHeight, lpbinary:bthumbImage, lpnull, lpnull) thumbImage = binarypeek4(bthumbImage, 0) binaryfree(bthumbImage) if r==0 then return thumbImage else return 0 #endfunction to use it, in the JPEG encode example i posted do something like, ;load image img = gpLoadImageFromFile(agp, inFile) imgThumbnail = gpGetImageThumbnail(agp, img, 100, 100) gpSaveImageToFile(agp, imgThumbnail, outFile, bJPEG, 50) gpDisposeImage(agp, img) gpDisposeImage(agp, imgThumbnail)Note that all the code is omitted but i tested it and it works, you will need to do some math if you want to keep the aspect ratio. Reference: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Samples~from~Users+GDI~Image~Encoding.txt
- Guido
Article ID: W17219
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38