Bicubic Sharper resampling

In Photoshop, we usually use "Bicubic Sharper" resample to reduce image size. Is it possible to implement some sort of sharpening for the resized images?

Comments

  • That would definately make the resized images look nicer but it seems to me that something like sharpening would be very resource hungry....granted I dont know anything about php.
  • From what I just read.. yes.. it is very resource hungry. With that being said.. here is a script that someone created that will do that.. not sure how easy that is to integrate.. Obviously it would be a "hack" of zenphoto to impliment it unless tris decided he wants it.. but here it is

    http://vikjavev.no/hovudsida/umtestside.php.
  • Good find Chilifrei64!

    I was wondering if there are alternative solutions other than GD (ImageMagick, NetPBM, etc) that can do this with less resource usage. Of course, we'd need to figure out how integrate it into ZP =)
  • trisweb Administrator
    astorm, I always though adding ImageMagick support would be a cinch, mainly because all the image processing is contained nicely in i.php, and you can just do a couple switches and use ImageMagick's functions instead of GD. I've always wanted to see if there's a speed difference, and the extra compatibility is good, so I imagine it will happen someday.

    I probably won't add this filter beacuse of speed and personal preference differences, but once we get a good real plugin system, image filters could be added to customize your installation! :) (that's a ways off though).
  • xebeque Member
    Since then: How about using a simple sharpening as with image-magick convert? It´s much faster than unsharp mask but provides good results.
    I´d tried it if I found the gd code in zen. ANy hint for me?
  • trisweb Administrator
    It's in i.php -- you're welcome to try an ImageMagick conversion, but it's likely to be difficult... good luck! I'd be happy to help if you have questions, or maybe I'll just try it myself...
  • xebeque Member
    Well - for me coding is like flying blind - I actually never learnt enough to get any usable results. Thus I give up. But i found the following code which might be helpfull for others:

    $sharpenMatrix = array(-1,-1,-1,-1,16,-1,-1,-1,-1);
    $divisor = 8;
    $offset = 0;
    imageconvolution($newim, $sharpenMatrix, $divisor, $offset);

    which is said to have a sharpening effect - but i cannot handle it.

    I also found a function gdImageSharpen(gdImagePtr im, int pct) (look here http://www.boutell.com/boutell/gdmanualtest.html#gdImageSharpen)
    that left me helpless.
    I´d have liked to be a more successful contributor to zenphoto
  • trisweb Administrator
    Nah, it's okay. I probably wouldn't include any of that by default anyway. Leave it for a plugin developer later down the line :)
  • xebeque Member
    Maybe somebody else with better coding skills is as impatient as I am...
  • trisweb Administrator
    Impatient for sharpening? Wow...

    Try that convolution matrix in your earlier post again, you just have to do it before any image is saved (with the imagejpeg command). Read up on PHP and the GD image functions, it's not too bad :)
  • I pasted the exact code from above before imagejpeg (after line 215 in i.php V. 1.0.3 beta).
    No more image is shown cause image processing fails somehow: cache shows 0-byte images.
  • trisweb Administrator
    Ahh, this is called debugging! :) Check the logs for an error message, or disable the redirect (comment-out the header: Location line) and see what going to `i.php?a=album&i=image&s=size` directly shows.
Sign In or Register to comment.