angusj
Members-
Content Count
132 -
Joined
-
Last visited
-
Days Won
8
angusj last won the day on April 24 2023
angusj had the most liked content!
Community Reputation
126 ExcellentRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Poor image quality with DrawBitmap when destination is smaller than source
angusj replied to XylemFlow's topic in FMX
It's a problem with the Graphics32 library too if TAffineTransformation is used to do the scaling. -
Poor image quality with DrawBitmap when destination is smaller than source
angusj replied to XylemFlow's topic in FMX
If you avoid using TAffineTransformation, and just use a resampler together with a renderer, then you do avoid this issue with pixelation. (In my Image32 graphics library, I use affine transformations without a renderer.) -
Poor image quality with DrawBitmap when destination is smaller than source
angusj replied to XylemFlow's topic in FMX
I've just had another look at resampling and specifically downsampling, and I'm back to my starting assertion that box downsampling does produce better quality images than general purpose resampling algorithms. However, I will concede that, because these downsampled images are generally much smaller, it's usually difficult to spot these differences. For example: This is the fruit image from above that has been resized to 1/3 original using a bicubic resampler: This is the fruit image from above that has been resized to 1/3 original using a box downsampler: Yes, it's hard to spot the differences unless you compare them with a decent image editor (or just zoom in using your web browser). Yet here's a more extreme example of downsampling (scaled to 0.1 of original size) where the quality differences are very noticeable: Bicubic kernel resampler: Box downsampler: Original image: And this does make sense when you understand the differences between these algorithms. Consider downsampling an image to 1/3 its size (where each 3 x 3 grid of pixels will merge into a single pixel) ... box downsampling will weigh every pixel equally in each 3 x 3 grid; whereas general purpose kernel resamplers will heavily weight pixels that are closer to the middle of these 3 x 3 grids. -
Compute nearest color
angusj replied to FPiette's topic in Algorithms, Data Structures and Class Design
Indeed, Octree does have significant limitations just as you've illustrated above. Anyhow, here's the image reduced to 16 colors using (a slightly modified) median cut ... -
Compute nearest color
angusj replied to FPiette's topic in Algorithms, Data Structures and Class Design
Yes, several bugs needed fixing which I've done and just uploaded. And I'm expecting you'll find a few more 😱. Anyhow, thanks 😁. -
Compute nearest color
angusj replied to FPiette's topic in Algorithms, Data Structures and Class Design
This link to the Color Quantization unit in my own Delphi Graphics Library may also be useful to you. The code there should be quite easy to adapt to Graphics32. -
https://www.angusj.com/delphitips/getversion.php
-
Favorite feature(s) of other editors that Delphi does not offer
angusj replied to dummzeuch's topic in Delphi IDE and APIs
MSVS does even better that that, it also suggests how to improve your code. (Well it does for me, but perhaps not for you if your code can't be improved 😜.) Over almost 30yrs, I've written a lot of very useful (ie reuseable) Delphi code, otherwise I would have ditched Delphi years ago. -
https://stackoverflow.com/questions/24789766/drawing-a-bezier-curve-using-firemonkey
-
Store a large number of images in the filesystem or in a DB?
angusj replied to RaelB's topic in Databases
If you're only searching by filename or file type (*.jpg;*.png; etc) then the filesystem would suffice. -
Poor image quality with DrawBitmap when destination is smaller than source
angusj replied to XylemFlow's topic in FMX
LOL 🤣. The pages perhaps are "cooked" but it wasn't intentional. Anyhow, I've just done a number of followup tests and I'll concede that I can't spot the difference between all 3 renderers when downsampling various images. I'm surprised and I'll need to refresh myself on the differences between these resamplers. -
Poor image quality with DrawBitmap when destination is smaller than source
angusj replied to XylemFlow's topic in FMX
Looking at the image in the OP, it looks like FMX is using a nearest neighbour resampler, which is fast but poor quality. Certainly a bilinear or bicubic resampler would be much better, but for down sampling specifically, a BoxDownSampling resampler would be better still. -
Yep, point taken.
-
Or you could make the bitshifting explicit : inc(Cache.b, (ps.rgbBlue*alpha) shr 2); And given that you're multiplying two bytes you could optimise this further by using a lookup table: MulTable: array [Byte,Byte] of integer; //initialized in initialization section ... inc(Cache.b, MulTable[ps.rgbBlue, alpha] shr 2); Edit: Oops, sorry, it appears that alpha is an integer, not a byte.
-
4 😁 Edit: Perhaps it just means re-star-ting? Edit2: It's very easy to rename a repository (via Settings) and you won't lose any stars!