Douglas Farias Expert Licensed User Longtime User Sep 1, 2014 #1 Hi all, have a way to compress image on b4a? for exemple i have image with 1 mb + and i use compress image go to 200 kb 100 kb etc like http://compressjpeg.com/
Hi all, have a way to compress image on b4a? for exemple i have image with 1 mb + and i use compress image go to 200 kb 100 kb etc like http://compressjpeg.com/
KMatle Expert Licensed User Longtime User Sep 1, 2014 #2 What is the source of these images? Own source: I use a batch converter like XNView (Windows) to reduce the size to 640x480 or 800x600 with 80% quality. The results are very good. Compressing JPGs (JPG IS a compressed format) is almost impossible Or not effective) without reducing the size. Upvote 0
What is the source of these images? Own source: I use a batch converter like XNView (Windows) to reduce the size to 640x480 or 800x600 with 80% quality. The results are very good. Compressing JPGs (JPG IS a compressed format) is almost impossible Or not effective) without reducing the size.
Douglas Farias Expert Licensed User Longtime User Sep 1, 2014 #3 hi klaus thx for u response. but have this on b4a? i m making a app social based on images, and many devices have great cameras, 1 photo = 5 - 10 mb its a problem to upload photo to server, have a way to compress the image in b4a? get the photo with 7 mb make this 200 300 kb and send to server later compress ? 7 mb is a big internet problem *-* images is jpg or png only 2 Upvote 0
hi klaus thx for u response. but have this on b4a? i m making a app social based on images, and many devices have great cameras, 1 photo = 5 - 10 mb its a problem to upload photo to server, have a way to compress the image in b4a? get the photo with 7 mb make this 200 300 kb and send to server later compress ? 7 mb is a big internet problem *-* images is jpg or png only 2
Shahid Saeed Active Member Licensed User Longtime User Sep 1, 2014 #4 Maybe some expert can help you do this here are some reference of Bitmap API to compress JPG You can find API here: http://developer.android.com/refere...ap.CompressFormat, int, java.io.OutputStream) Code: bitmap.compress(Bitmap.CompressFormat.JPEG,100,out) compress (Bitmap.CompressFormat format,int quality,OutputStream stream) Upvote 0
Maybe some expert can help you do this here are some reference of Bitmap API to compress JPG You can find API here: http://developer.android.com/refere...ap.CompressFormat, int, java.io.OutputStream) Code: bitmap.compress(Bitmap.CompressFormat.JPEG,100,out) compress (Bitmap.CompressFormat format,int quality,OutputStream stream)
S sorex Expert Licensed User Longtime User Sep 1, 2014 #5 just resize the bitmap/canvas to what you prefer, it's part of the B4A core already. Upvote 0
Douglas Farias Expert Licensed User Longtime User Sep 1, 2014 #6 yes i m using canvas but no much diference for example image 2000x2000 7mb with canvas 400x1000 go to 5 mb *-* Upvote 0
yes i m using canvas but no much diference for example image 2000x2000 7mb with canvas 400x1000 go to 5 mb *-*
MaFu Well-Known Member Licensed User Longtime User Sep 1, 2014 #7 Which quality factor did you use for compress? Upvote 0
S sorex Expert Licensed User Longtime User Sep 1, 2014 #8 doesn't make sense, even a raw format like targa (TGA) would have that 400x1000 smaller than 5Mb. show the code you're using. Upvote 0
doesn't make sense, even a raw format like targa (TGA) would have that 400x1000 smaller than 5Mb. show the code you're using.
LucaMs Expert Licensed User Longtime User Sep 1, 2014 #9 If the images represent the users, I think is better allow them to choose a picture from the gallery, inviting them to choose a maximum size decided by you. You could use LoadBitmapSample after they took the photograph, but greatly reducing the size of the photo, the quality becomes poor. Upvote 0
If the images represent the users, I think is better allow them to choose a picture from the gallery, inviting them to choose a maximum size decided by you. You could use LoadBitmapSample after they took the photograph, but greatly reducing the size of the photo, the quality becomes poor.
Douglas Farias Expert Licensed User Longtime User Sep 1, 2014 #10 only canvas with 70 quality Upvote 0
Douglas Farias Expert Licensed User Longtime User Sep 1, 2014 #11 the strange is with php i can compress a image with for example 7mb to 500kb and i dont see any diference on b4a when u compress lost most quality and 7 mb go to 5. i dont need load this image on the app, i m only open contenct chooser and user selectr a photo, later i make upload to server. the only problem is the size 7mb per photo is slow *-* i need fint a way to send with 500kb , 700kb and dont lost much quality like this website http://compressjpeg.com/ 7mb go to 500kb and dont lost quality Upvote 0
the strange is with php i can compress a image with for example 7mb to 500kb and i dont see any diference on b4a when u compress lost most quality and 7 mb go to 5. i dont need load this image on the app, i m only open contenct chooser and user selectr a photo, later i make upload to server. the only problem is the size 7mb per photo is slow *-* i need fint a way to send with 500kb , 700kb and dont lost much quality like this website http://compressjpeg.com/ 7mb go to 500kb and dont lost quality
S sorex Expert Licensed User Longtime User Sep 1, 2014 #12 my guess is that you don't resize at all, you just open and save again. Upvote 0
MaFu Well-Known Member Licensed User Longtime User Sep 1, 2014 #13 I think so too. A 2000x2000 jpg with quality 70 should have 300 - 500 kb (depends on content). Upvote 0