Reduce image size with taifunCamera

Hi,

I am trying to reduce the size of the image in the Taifun Camera module to speed it up, but I can only reduce the quality of the image, the size is always big. Setting the image size to the minimum size returned by SupportedPicturesSizes doesn't seem to affect the size of the image as returned by the parameter in .afterpicture
I only need really small pictures for ocr, but I need speed of at least 1 image per second. Is that even doable on App Inventor?

are you using the latest version 6?

what does your device return after using the SupportedPictureSizes method?
in the after picture event the width and height of the taken picture can be displayed, what do you get there? also in that event there is the log parameter to check, what is going on...

what happens if you try the example project?

this depends on your device

to take pictures as fast as possible after a picture has been taken, start taking the next picture in the after picture event without using a clock

Taifun

Hi Taifun. Thank you for your swift answer.

what does your device return after using the SupportedPictureSizes method?
It returns a list of image sizes between 4160x3120 and 320x240
in the after picture event the width and height of the taken picture can be displayed, what do you get
Height 3120
Width 4160
there? also in that event there is the log parameter to check, what is going on...
It says: width x height: 320x240
setPictureSize: 320x240
size 4160-3120

The device to run it on is a cheap quad core little smart phone...

your blocks look correct...

it looks like it tries to set the small size but for some reason it is not able to do so on that device
what hapens if you try another device?

Taifun

On Android 11 app I get 8000x6000 for the 3 dimensions mentioned earlier. also the quality stays at 80

Quality = 10:

grafik

Quality = 100:

grafik

Yes. The quality does reduce the image size substantially. Still the picture takes 3 secs to take.

I was trying to take it from AfterPicture, but I guess I am doing that wrong.

This crashes on Android 11 and does nothing when I press the button on A10

you are still using a clock component, you might want to remove it...
also you now created an endless loop, because there is no possibility to stop the taking pictures loop anymore, your logic is: take picture - after picture event: take picture again, etc etc
you might want to add some logic and provide an exit, for example depending on the counter

to find out why that happens, use logcat

Taifun

I now modified my timelapse example (which uses the front camera) and tested it on Samsung Galaxy A54 running Android 13... (I send it to you in a PM)...

reducing the width and height as well as the quality worked fine for me
however taking a picture unfortunately takes its time... still around 2 seconds per picture... the darker the picture the worse...

for your requirements you probably have to use an extension, which uses the new camera2 api...
try the Pro Camera Extension by Kumaraswamy_B.G

Taifun