[F/OS] 🖼️ ViewUtil: Convert a component into an image!

I do not see this behaviour. Testing with companion app, the file is saved and returned for display almost immediately.

image

It happens too quickly for the Progress Dialog to display itself!

1 Like

Thanks a lot for testing so quickly. I really appreciate.
You are right, it looks like it is working fine with a single image, and I assume that when we retrieve the image, it is in the cache, so it works
If you save an image one.png, then save an image two PNG, and then read two PNG you get one PNG
I'll work tomorrow on a clean sample app that I can share (current one is messy as I made many different trials)

I made a small test app that allows to switch between two images to be displayed in a horizontal arrangement, and a button to save this arrangement (SaveComponentAsImage) and display it.
Saving this arrangement is OK the first time, but if we switch the image, when saving I get the old image, not the new one.

Here is the app: Test_SaveComponent.aia (367.2 KB)

Any idea on what I am doing wrong?

Thanks

Hmmm, I see :wink:

Requires further investigation. It is not the other extensions (Taifun File / GetASD) the same happens without them.

It is @Gordon_Lu 's extension causing the problem, possibly this ?

view.setDrawingCacheEnabled(true);
Bitmap b = view.getDrawingCache();

Try this one instead, seems to work just fine

Thanks for the investigation.
I tried the extension you mention, but when calling ConvertToImage, I do not get the event Created and it does not work.
@TIMAI2 : Did you try it?
@Gordon_Lu : Could you have a look to that issue ?
Thanks a lot for your support

This block ?

image

works OK for me

Yes, this bloc.
Do you have a small AIA using this bloc which is working?

image

C2IExtnTest.aia (16.4 KB)

Your App is working for me
I found my problem, I was using version 1 of the extension, I switched to version 2 (the one you are using), and now my app is working :slight_smile:
Thank you very much

1 Like

I'll fix it, possibly today.

1 Like

I have fixed this bug, along with other new features.

:bug: Bugs fixed

  • Fixed the bug that the image is temporarily saved in the cache.

  • Ensured that the FileOutputStream is flushed and closed after saving the image.

:hammer_and_wrench: New functions

  • Added support for full paths. You will also no longer need to input the ASD; start the path with nothing like button.png instead of /storage/emulated/0/.../packagename/files/button.png.

  • Removed the compressFormat parameter and relevant properties. The extension now automatically detects the image type you want to set from the file path. Supported image formats are JPG, JPEG and PNG.

  • Renamed path to filePath, and added a fileSize parameter to return the size of the image in bytes.

@Jacques_Dumarest, I have updated your AIA to use the latest version of the extension. Does it work now? Test_SaveComponent_1.aia (368.8 KB)

Summary

I'm on vacation and I'm writing extensions on a laggy Windows 7 computer. When I get back home, I'll migrate this extension to Extension Template and add more features.

Will update the extension in the main post now, and the documentation tomorrow.

1 Like

No webp ?

No, no WebP. Surprisingly, Niotron IDE does not recognize the class of lossless or lossy WebP. I'll have to go home and try it with Rush.

Gordon, Thanks for the fix, now the updated App is working :slight_smile:
Please let me know when the extension is available for download

1 Like

The new documentation and the updated extension should be available now. Please update to the latest version, as I forgot to update the extension version number last night ...

1 Like

Could you provide the link to this update, not sure where to download it
Thanks a lot

I replaced the old download link with the new one in the main post.

What is the link of the main post? I can't find it