Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a better way to anti-alias rounded corners for an image with PHP than resizing?
    primarykey
    data
    text
    <p>I am a developer of <a href="http://www.waveframework.com/" rel="nofollow">Wave Framework</a> and I recently implemented rounded corners (still unreleased commit) for my on-demand image loader - which allows the designer to fetch images by cropping them and resizing or adding filters to them on-the-go. </p> <p>You can see an example of this at <a href="http://www.waher.net/w/resources/images/400x200&amp;nw40&amp;se190&amp;ne10&amp;aa4&amp;liisu.jpg" rel="nofollow">http://www.waher.net/w/resources/images/400x200&amp;nw40&amp;se190&amp;ne10&amp;aa4&amp;liisu.jpg</a></p> <p>In the shown example in the original post the way it works is as follows:</p> <ul> <li>Fetch original image (<a href="http://www.waher.net/w/resources/images/liisu.jpg" rel="nofollow">http://www.waher.net/w/resources/images/liisu.jpg</a>).</li> <li>Resize the image to 400px or 200px and cropping out the parts that are left out of the new canvas.</li> <li>Increase the dimensions of image by 4 (the 'aa4' parameter in the URL).</li> <li>Add rounded corners (the 'nw40', 'se190' and 'ne10' parameters which stand for north-west 40px, south-east 190px and north-east 10px) with imagearc() and imagefilltoborder() functions to the resized image.</li> <li>Decrease the dimensions of image by 4, resulting in a final rounded-corners 400x200px image.</li> </ul> <p>While this works, it can cause performance issues. Since I allow anti-aliasing up to 8, this could mean that a 1600x800 image would be resized to 12800x6400 - which is absolutely dangerous and can kill requests due to memory concerns.</p> <p>Is there a better way to implement anti-aliasing in this situation?</p> <p>EDIT: Also note that ImageMagick is not an option in this case due to not being enabled by default in PHP and available in multiple hosting services.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload