Note that there are some explanatory texts on larger screens.

plurals
  1. POActionscript: resizing bitmapdata with smoothing
    text
    copied!<pre><code>var bd:BitmapData=new BitmapData(file.width,file.height); bd.setPixels(new Rectangle(0,0,file.width,file.height),file.raw); var scale_x_percents:Number = (w / bd.width); var scale_y_percents:Number = (h / bd.height); if(!stretch) { if(bd.width*scale_y_percents&gt;=w) { scale_x_percents=scale_y_percents; } else if(bd.height*scale_x_percents&gt;=h) { scale_y_percents=scale_x_percents; } } var matrix:Matrix = new Matrix(); matrix.scale(scale_x_percents,scale_y_percents); var resizedBd:BitmapData = new BitmapData(Math.floor(bd.width*scale_x_percents), Math.floor(bd.height*scale_y_percents), true, 0x000000); resizedBd.draw(bd, matrix, null, null, null, true); // true is smoothing option, it will blur sharpened pixels </code></pre> <p>Having problem with images resizing. Looks like smoothing is not working or something is missing in the code. Maybe Matrix should have something more?</p> <p>Original image:</p> <p><a href="http://imageshack.us/a/img28/4784/dc7f2ec4b0f3323cdc4e01e.jpg" rel="nofollow">http://imageshack.us/a/img28/4784/dc7f2ec4b0f3323cdc4e01e.jpg</a></p> <p>and it's result:</p> <p><a href="http://imageshack.us/a/img855/4784/dc7f2ec4b0f3323cdc4e01e.jpg" rel="nofollow">http://imageshack.us/a/img855/4784/dc7f2ec4b0f3323cdc4e01e.jpg</a></p> <p>I can link a bunch of others images. Some strange pixel disposition exist. Can it be fixed somehow?</p> <p>I have tested jpeg quality 100% and stage.quality='best', but none of them give the required quality outcome.</p>
 

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