Thank you! You helped me a lot and reduced my code.. But I have a problem- I don't have a Kodular community account (I do not want to make an account too) and can't download the extension of @Atom_Developer . Can you post it here?
If you want to use the canvas as a crop box, with Taifun's Image extension. The following work is just to demonstrate the functionality.
I have broken down the process to three aia projects to make it easier to understand what is going on.
The canvas is a fixed size, in these demos of 300x300 (important! - this relates to a magic number (276) in the blocks for the size of the image to be displayed). It is not possible to drag the entire frame, the user has to resize using the corners.
The frame
This aia creates a resizeable frame on the canvas. There is a button to allow for a dark or light frame for better visibility on an image.
This aia creates the resizeable frame, allows loading of images and allows the user to crop the image to the size of the frame. The original image, which comes from the assets, is copied to the ASD, and this is the file that is modified. The output is shown on the canvas.
I am working up an extension free version as well, but this is even more complicated due to the pixel manipulation required on the canvas (and it takes a while to process the image)
Credits to @Taifun for the Image and File extensions used in this demo.
Thanks a lot @TIMAI2. This is what I was looking for! I was just wondering how you all must be so good at math....This large amount of code would have surely taken me 2-3 months (or even more) to make. I'm not joking..
As attached in the above picture, I just want to crop like this and then show the resulting image in a image component. I'm getting the input picture from Camera. I tried this:
How can I do that? (please attach blocks)..
Also one suggestion:
Please add a documentation on the extension you made (if possible) as there are many blocks which can't be understood directly.
Thank you
As previously offered here find an aia project for an image cropper using no extensions. This takes a while to carry out the crop because it has to capture and redraw all the required pixels. The blocks are naturally more complicated than the previous projects. The original image is loaded into the canvas at full size to achieve the best standard of crop possible with this method.
This approach is really intended as a demo of what can be done if you put your mind to it, it is probably not practical for a production environment, an extension using the appropriate java libraries that works directly with the image file is a more useful solution.
Refer @TIMAI2 's aia files in this thread, he has done that in a very neat manner without any extension. You should refer that....if you want to use the extension then @Atom_Developer will help you out....
You mean replace all LIST PICKER SLECTION for IMAGE PICKER SELECTION?
I tried it, but something is wrong. The image doesn't come to crop
Here is my AIA file: Photo_Editor.aia (70.7 KB)
Please fix it for me, it would be a great help
The html file MUST BE in the same folder as the image files for this to work (in my example, everything is in the assets). If your images are stored elsewhere on the device, then a copy of the html file will need to be made to the images directory - or the directory above the images directory (you will have to change the relative path in the webviewstring you send).
I suggest you pick the file, then move it to a location in your ASD where you have also set a copy of the html file, make sure you call the html file from that path.
Please help me. I do not want to use a list picker but my image is stored on firebase storage, I want to crop the image. Please help. It would be so nice of you.