Clément 148 Posted December 23, 2022 Hi, Happy XMas! I must read a bunch o PNG images to my program and store them in a database. The pictures (PNG) have different height and width, and I must process them in order to keep all of them in 600x600. For example: I read a PNG image 704x404, I must cut 704 -> 600 and a must fill 404 -> 600 , without loosing transparency. I have some ideas of how to do it, but it must be "fast" and correct. Any ideas? Share this post Link to post
programmerdelphi2k 237 Posted December 23, 2022 (edited) maybe this way: https://stackoverflow.com/questions/59904761/transparent-png-image-loaded-from-resource-file-resized-with-grapics32-and-draw https://stackoverflow.com/questions/31271622/how-to-resize-png-image-with-alpha-channels-using-gdi Edited December 23, 2022 by programmerdelphi2k 1 Share this post Link to post
angusj 126 Posted December 23, 2022 (edited) Clement, there are a number of Delphi graphics libraries that will do what you want, so my answer would depend on the graphics library you're currently using. (IOW, it generally easiest to stick with what your familiar unless there's a good reason to change.) Edit: What you're generally looking for are image resampling algorithms, of which there are many. But, as almost always, there must be compromises between speed and image quality. And when you're down-sampling (ie making images smaller), then for quality I'd strongly recommend a down-sampling algorithm over a general image resampler. Bon Noël 🎄 Edited December 23, 2022 by angusj 1 Share this post Link to post
Fr0sT.Brutal 900 Posted December 26, 2022 In addition to native libs there's very powerful opensource ImageMagic project that could be called as lib or an external app. Share this post Link to post