开发者

Bicubic-ly Resize Images with Javascript

开发者 https://www.devze.com 2023-01-14 14:09 出处:网络
Is there a way to re开发者_如何学Gosize the actual image using JavaScript?I\'m not talking about modifying the DOM to get the browser to resize the image.I actually want to resize the image\'s pixel d

Is there a way to re开发者_如何学Gosize the actual image using JavaScript? I'm not talking about modifying the DOM to get the browser to resize the image. I actually want to resize the image's pixel data and then display that.

Basically my problem is: Firefox completely fails at downsizing images with delicate features because it only has Nearest Neighbor and Binlinear. Every other browser -- even IE -- has Bicubic support. There's talk of this being included in the near future but that talk has been going on for over a year.

I don't mind downloading the full sized images because I want them downloaded anyway. When the user hovers over the small version of an image, the large version immediately appears elsewhere on the page. If I did server-side resizing I'd have to download BOTH copies of the images which would result in even more traffic. If there's no other workaround then this is what I'm going to have to do... I just don't want to.


It is possible. You get a image on the same domain, write to canvas, then manipulate pixel data from there (complicated, but possible I'm sure), and then either use that or output as png/gif/jpg... BUT... I don't think you will find it will better way to preserve delicate features that CSS.

0

精彩评论

暂无评论...
验证码 换一张
取 消