glfx.js | An image effects library for JavaScript using WebGL | Graphics library
kandi X-RAY | glfx.js Summary
kandi X-RAY | glfx.js Summary
Adjust photos in your browser in realtime with glfx.js, an image effects library powered by WebGL. It uses your graphics card for image effects that would be impossible to apply in real-time with JavaScript alone. There are two caveats to glfx.js. First, WebGL is a new technology that is only available in the latest browsers and it will be quite a while before the majority of users have it. Second, due to the same origin policy, JavaScript is only allowed to read images that originate from the same domain as the script reading them, so you may have to host the images you modify.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Shows an image .
- Determines if there are floating point textures
- Shows a set of edges
- Slifts a point .
- Compiles a pixel pixel to a mesh
- Creates a zoom blur .
- Specular blur a texture
- Creates a splineInterpolation interpolation object .
- Computes the HSL component .
- Shade the color of a circle .
glfx.js Key Features
glfx.js Examples and Code Snippets
Community Discussions
Trending Discussions on glfx.js
QUESTION
First I would like to select among radio buttons, and then based on the selected button I would like to call a series of different javascript files (see demo.js and demo1.js is the difference). Here is my code, but it doesn't work:
...ANSWER
Answered 2020-Aug-22 at 14:54The below example will display an input field when clicking yes
.
QUESTION
I´m trying to take a photo and analyze it with the tesseract OCR engine in ionic 3 App for iOS. I´m trying to run it on a iPhone 8 iOS 11.2.6
Unfortunately I get an error in Xcode
after taking a photo, and the app crashes:
NSURLConnection finished with error - code -1002 and also WARNING: sanitizing unsafe URL value assets-library://asset/asset.JPG?id=A791150A-3E89-400E-99D3-E7B3A3D888AA&ext=JPG
Thank you for your help
home.html
...ANSWER
Answered 2018-May-30 at 13:01I do not know much about Ionic, but loading an img in Angular could cause an UnsafeUrl Exception.
Maybe you need to use a Dom Sanitizer.
DomSanitizer using example:
Inject it:
QUESTION
I have been playing around with GLFX.js and have been able to setup some effects. What I am missing however is the capability to use each effect together in a sort of layering/blending. Currently if I increase the slider for say Sepia, and then increase the value for Saturation, Sepia will reset. I have an inclination that I somehow need to save the current value of the effect on the image each time the slider is updated but not sure how to go about doing that. Any help would be greatly appreciated. Thank you in advance! Here is my Javascript code:
`
ANSWER
Answered 2018-Mar-19 at 22:29As you probably know I can't post a runnable snippet because of cross origin security restrictions, hence I only post my source code. It works and I'm able to apply "ink" and "sepia" effects together. Notice that there is only one call to draw
and update
for all effects. Check by yourself and tell me whether it is helpful or not.
QUESTION
I have a MeshBasicMaterial with VideoTexture. Can I apply custom shaders to the material dynamically. I was able to apply shader to the complete scene using THREE.EffectComposer but what if I want to apply custom filters to a specific element inside the scene. I want to test simple filters like sepia, hue-saturation. Also I must be able to switch between the two without reloading the project.
I did not go with js libraries like seriously.js or glfx.js because it may cause problem at later stages when I will work with three.js objects not having canvas/img/video as map.
...ANSWER
Answered 2017-Jun-07 at 10:14THREE.EffectComposer has a .reset function that you could use to wipe it, and then add the new filters you want. So just load the different filters you want to cycle through into an array, then reset and add passes from that array.
EDIT I thought you were talking about changing shaders in the composer. To change shaders on an object, you can create multiple shadermaterials with different shaders but referencing the same texture, and swap the materials out on the object. So you can write a shader that reinterprets the texture colorspace to sepia, one that reinterprets the texture colorspace to bnw, or swizzles hue and saturation with r,g, or b.
Then you swap multiple materials out on the fly. These effects are basic glsl, but if you have trouble writing the shaders, just post another thread with specific problems. If you're a glsl novice, I highly recommend the book of shaders. It's a great, fast, interactive crash course on glsl.
But the solution to your problem is to create multiple shadermaterials, or create one shader material that does everything and then use uniforms to enable/lerp between the different effects.
QUESTION
I am using the glfx.js library in order to use matrix transformation to create the perspective effect for my images. In my app, the system works just like photoshop's smart objects (where you render a flat image and get perspective results after render)
glfx.js uses this function canvas.perspective(before, after)
to apply matrix transforms to images, by assigning before and after coordination of the 4 points in an image, and it runs the Matrix command in the background to transform my image.
My issue is that if the resulting image that I want after the transformation applied to it is bigger than the original image (happens if you rotate the image) then the WebGL canvas is going to crop my image.
Look at the following fiddle:
...ANSWER
Answered 2017-Jan-26 at 21:29There is no cover all solution. This is because when you convert from 2D to 3D the size of the projected image can possibly approch infinity (near clipping prevents infinity) so no matter how large you make the image output there is always the possibility of some clipping being applied.
With that caveat out of the way there is a solution for most situations that can avoid clipping. It is very simple, just expand the canvas to hold the additional content.
Find the boundsTo simplify the calculations I have changed the after array to a set of normalised points (they represent the after coords as a scale factor of the image size). I then use the image size to convert to real pixel coordinates. Then from that I workout the min size a texture needs to be to hold both the original image and the projection.
With that info I just create the texture (as a canvas) draw the image. Adjust the befor array if needed (in case some projection points are in negative space) and apply the filter.
So we have an image object that has a width and a height. And you have the projection of those points.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install glfx.js
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page