I've an app that places an effect on a bitmap from a camera shot. it works fine on my Galaxy portal but when trying the app on HTC Desire the jpeg image is small. How can i set the picture size that is ultimately displayed to the full size of the screen? On the Galaxy i've used BitmapFacory.Options sample size=1, this makes the image the same size as the one captured, but on different phones this doesn't work. thanks.
There is a difference between the capture size and the preview size (the screen size never changes that's device specific) so I am assuming you are talking about the capture size.
You can only select a capture size that is supported by the camera Selecting Supported Image Sizes so I suppose you could select the highest size that a camera supports, but if you want to normalize the size (make same on each camera) then you would have to scale the resulting image up or down dependent.
But I am wondering if this is what you are really after, or are you trying to place the image in a specific location (like the center of the captured image) and possibly scaling the overlaid image to a percentage of the captured image?
Related
I want to change the size of an image taken by the camera say 600x800. I am successfully doing so and its working fine but I also want to change the byte size or you can say memory as well. Like the photo resizer app https://play.google.com/store/apps/details?id=com.xllusion.app.photoresizer&feature=search_result on google play. For example if I take a photo on this app and change the resolution to 600x800. It creating this resolution photo simply with 23kb(no quality compromise) where as original photo was of 600kb. Can somebody help???
This is a Phonegap android app that uses HTML5 canvas (preferably with fabricjs). One of the required functionality is that it can load image from gallery/take picture from camera and save the image after some preset edits. The input image/image taken from camera may be different in size depending on the device but the output image needs to be of fixed size (900x450 in this case) always. The app is supposed to support devices with both smaller and bigger screens. I can load the image to the canvas of preset size and export data url (after edits). But how do I get around using it on a smaller screen? I can display a smaller scaled down canvas and do manipulations there and do the actual stuff on a hidden canvas of the required size, but that would be very messy. Is there a better approach to this?
How about just “scaling” your canvas element by setting its width/height via CSS?
This should not affect the actual pixel size of the canvas element.
I've always been under the impression that the preview and the final output are not connected in any way; meaning that I can set the preview to be some arbitrary dimension and that the final JPG will be whatever specific resolution I set in to be in the params, but I just ran into a very odd situation where the image data coming back in the byte[] that's in the jpg callback is different, depending on what dimensions I set my preview to.
Can someone enlighten me on what actual relationship the preview has on the final JPG? (or point me to documentation on said relationship).
TIA
[Edit]
As per ravi's answer, this was my assumption as well, however, I see no alternative but to surmise that they are, in fact, directly connected based on the evidence. I'll post code if necessary (though there's a lot of it) but here's what I'm doing.
I have a preview screen where the user takes a photo of themselves. I then display the picture captured (from the jpg callback bitmap data) in a subsequent draw view and allow them to trace a shape over their photo. I then pass the points of their polygon into a class that cuts that shape out of the original image, and gives back the cut image.
All of this works, BUT depending on how I present the PREVIEW, the polygon cutting class crashes on an array out of bounds index as it tries to access pixels on the final image that simply don't exist. This effect is produced EXCLUSIVELY by altering the shape of the preview View's dimensions. I'm not altering ANYTHING else in the code, and yet, just by mis-shaping my preview view, I can reproduce this error 100% of the time.
I can't see an explanation other than that the preview and the final are directly connected somehow, since I'm never operating on the preview's data, I only display it in a SurfaceView and then move on to deal exclusively with the data from the JPG callback following the user having taken their photo.
There is no relation between the preview resolution and the final image that is captured.
They are completely independent (at least for the still image capture). The preview resolution and the aspect ratio are not interrelated with the final image resolution and the aspect ratio in anyway.
In the camera application that I have written, the preview is always VGA but the image I capture varies from 5M to VGA (depending on the device capability)
Perhaps if you can explain the situation it would be more helpful.
We are currently developing a camera application and face very similiar problems. In our case, we want to display a 16:9 preview, while capturing a 4:3 picture. On most devices this works without any problems, but on some (e.g. Galaxy Nexus, LG Optimus 3D), the output camera picture depends on the preview you've chosen. In our case the outcoming pictures on that devices are distorted when the preview ratio is different from the picture ratio.
We tried to fix this, by changing the preview resolution to a better one just before capturing the image. But this does not work on some devices and occure error while starting the preview again after capturing is finished.
We also tried to fix this, by enlarging the SurfaceView to fullscreen-width and "over fullscreen"-height to make a 16:9 preview out of a 4:3 preview. But this does not work, because SurfaceViews can not be higher then screenheight.
So there IS any connection on SOME devices, and we really want to know, how to fix/workaround this.
As part of this application I am making, I want to change my wallpaper on my android device based on a bitmap that the user has selected.
I am able to change the background. However, the background is a completely distorted version of the bitmap. Any idea as to why this would happen?Here is my code:
Bitmap bitmap = ((BitmapDrawable)currentDrawable).getBitmap();
this.setWallpaper(bitmap);
My bitmap has a width of 240px and height of 180px. My emulator is of a size 480px by 800px.
I can scale my bitmap to 480px. However, the bitmap still ends up being distorted on the android wallpaper. Any thoughts on how this can be fixed?
Thanks in advance
You should create multiple images, for each potential (and common) resolution. You don't want any scaling, or the image will be distorted.
UPDATE:
Here is a ton of good information on support multiple screen sizes:
http://developer.android.com/guide/practices/screens_support.html
The wallpaper used by the default Launcher is bigger than the actual screen, that's why you can scroll the content and the wallpaper too.
Im trying to get the preview from the separate backfacing cameras in HTC Evo 3D. I access the camera using camera.open(CAMERA_STEREOSCOPIC) but the preview aspect ratio is 640x480 or 1270x768. There are two camera images at the same image side by side.
Obviously some of the image information is lost, because each image is half the original size in x axis. I want to do some image processing so I need the full sized images. And also, taking pictures and then processing is not what i want to do.
Any ideas?
regards
Lukas
" Note that we need to check the result of our call to DisplaySetting.setStereoscopic3DFormat in case the method fails for any reason. It will return true if it succeeded setting the format otherwise false.
If it should fail, you will be displaying a side be side LR image, which is probably not what you intended. In this case you may want to crop the L or R image out and scale the image to the appropriate size."
The info from HTC official website: http://www.htcdev.com/devcenter/opensense-sdk/stereoscopic-3d/s3d-sample-code/
Maybe you should post the code and see what actually happens inside.