Applying WebGL filter on HD Images cuts the image (fabric V2-beta-6)

喜夏-厌秋 提交于 2019-12-02 09:33:09

问题


Currently working with fabric 2.0.6 to apply filters on HD images. I need to apply the filters in least amount of time. for that purpose i am using the webGL method to apply filters as explained here (fabric.js demo). If you apply it on images with size <= 1 MB it works perfectly fine but with image size greater than that, filter does apply fairly well but it cuts the image in doing so. Attaching the test Image and applying greyscale filter for reference

Original Image(size 1.90 MB)

How it appears before applying filter

How it appears after applying greyScale filter


回答1:


Please if you refer to changelog and explanation:

http://fabricjs.com/fabric-filters

instead of looking at a demo application, you will notice that the doc talks about a fabric.textureSize property.

The limit is unrelated to the size in Megabytes, but is related to pixel size.

It is set up at 2048, size as base setting, to accomodate most of old hardware and giving you a max 2048x2048 filter size.

Rise this value before starting your app to the maximum size you think you want to support. 4096 for example.

If you go over 5000 you will probably loose support for ie11.

There are 2 limits you have to be aware of: Max canvas size in the browser and max texture size in the hardware of the laptop your user is using.



来源:https://stackoverflow.com/questions/46067427/applying-webgl-filter-on-hd-images-cuts-the-image-fabric-v2-beta-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!