Hi All,
I've recently written a little script to generate thumbnails of images I've uploaded. I've noticed though, that the resized thumbnails don't look as good as they would in, say, Photoshop. While I have no delusions to being able to duplicate Photoshop with PHP and gd, I was wondering how close I could get? I was thinking maybe using anti-aliasing somehow, or perhaps blurring the image a bit after creation. Does anyone have any leads on how to do this? Thanks a bunch.
Anti-aliasing/blurring images
Moderator: General Moderators
Anti-aliasing/blurring images
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
afaik, there's no built-in functions for blurring. So, creating a convolver is the next best route. You pass a matrix of numbers (2 dimensional array) containing the weighting of neighboring pixels. Each pixel is read, along with it's neighbors and run through the matrix.. it's quite time consuming, but you can get interesting results playing around with the matrix.
For instance, you can pass a matrix that'd blur or do edge detection or many other things.
You could also create your own scaling routine that does subpixel sampling or bilinear/trilinear filtering of the stretch.
For instance, you can pass a matrix that'd blur or do edge detection or many other things.
You could also create your own scaling routine that does subpixel sampling or bilinear/trilinear filtering of the stretch.
Or I can say to heck with it - it's not that necessary.feyd wrote: So, creating a convolver is the next best route. You pass a matrix of numbers (2 dimensional array) containing the weighting of neighboring pixels. Each pixel is read, along with it's neighbors and run through the matrix.. it's quite time consuming, but you can get interesting results playing around with the matrix.
For instance, you can pass a matrix that'd blur or do edge detection or many other things.
You could also create your own scaling routine that does subpixel sampling or bilinear/trilinear filtering of the stretch.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.