Low res image scaling - No resample
Monkey Forums/Monkey Programming/Low res image scaling - No resample
| ||
Is there a way I can scale images without blurring them? Think retro pixel art. For example, if I had a 5x8 pixel stick figure, how do I scale that up in the program without blurring the image? (Preserving the pixel effect) |
| ||
Not at the moment (short of modifying your targets mojo file). Monkey tells OpenGL to use linear filtering on all loaded textures which is why things get blurry when scaled up. |
| ||
I'd like to be able to switch this off, too. |
| ||
Out of curiosity, I took a look at the HTML5 specs and it seems filtering is not configurable: From the HTML5 Standard: If the original image data is a bitmap image, the value painted at a point in the destination rectangle is computed by filtering the original image data. The user agent may use any filtering algorithm (for example bilinear interpolation or nearest-neighbor). So probably for the sake of uniformity, particularly at this early stage, bilinear filtering is the only option. |
| ||
Nearest neighbor I believe preserves sharp pixels |
| ||
Anisotropic filtering would be nicer than linear filtering, maybe a SetFilter( NONE / ANISOTROPIC / BILINEAR / TRILINEAR1-16 ) command would be nice to have. |
| ||
Any word on this Mark? Is it something I can do myself for all targets? or is it not possible in HTML5? |
| ||
It's simple on Mozilla and it's supported in CANVAS : https://developer.mozilla.org/En/CSS/Image-rendering Not sure if it's available on Safari yet... |
| ||
Looks pretty straight forward in Android too: http://stackoverflow.com/questions/2517641/how-to-draw-and-scale-a-bitmap-on-a-canvas-using-bicubic-interpolation-in-android What about iOS and Flash? Cause I'm almost sure that the others would support it |
| ||
+1 for Setfilter functionality. Pixel gfx with bilinear filtering looks garish! |
| ||
Any news on this? Has anyone solved this? |
| ||
Not sure if this does what you need #MOJO_IMAGE_FILTERING_ENABLED="false"prevents blurring. It doesn't work in HTML5 but I believe it was possible to hack it with some CSS. |
| ||
You can try to use Mojo HTML5 GL patch. It includes fix for #MOJO_IMAGE_FILTERING_ENABLED support |
| ||
Thanks for your answers, I will go check out those options! |