I am trying to use custom marker using marker image that is provided as .bmp file. I am building cross platform application using Flutter and this is the native code for Android. The image is from the assets in pubspec.yaml in flutter project.
marker = map
.addMarker(MarkerOptions()
.position(annotation.coordinate)
.title(annotation.title)
.icon(BitmapDescriptorFactory.fromAsset("lib/green_circle.bmp")))
I got this error message for the code above:
com.google.maps.api.android.lib6.common.apiexception.b: Failed to
decode image. The provided image must be a Bitmap.
I checked the image, and it's bmp
There seems to be a problem with the way it handles the images. It does accept png, jpg and bmp, as I have tested with all of those, but I also had that same issue with some files of these formats (png and bmp).
What I did was open some of the files on another image editor, overwrite the files, and it worked. Weirdly, the files were normal png icons from Adobe Photoshop, and they didn't work.
If you have any issues or doubts, maybe try debugging with files from other sources, or editing it and saving it again.
I received the same error message for a different reason. My file was fine, but I provided an incorrect path to the file.
Make sure you get the directory and filename correct!
Related
I have an address to my mobile image like
/sdcard/DCIM/Camera/1.jpg
or
/storage/emulated/0/DCIM/Camera/1.jpg
I use QFile and QImage for read that
when read image with qfile, it can't open that but exist function return true
qimage also can't load image
I also use file:// before upper addresses but not worked.
I use qt 5.8 and api 23(android 6) and i make android manifest file and take permission for read and write to storage.
Your problem may be related to using too large resolution images. If you set the sourceSize property, it scales down youre image to the desired resolution.
So, I am loading icons from a server using the class found here:
https://developer.android.com/samples/DisplayingBitmaps/src/com.example.android.displayingbitmaps/util/ImageWorker.html
However, the images are not maintaining their transparency. If I view the image in my browser and view the details of the file, it recognizes the file as a PNG file and the transparency is there. It loses it when I load it onto my device.
The issue I believe is that the files do not have a .png extension and Android may not be able to detect that the files are PNG files automatically. This is my best guess, but I'm open to other potential solutions. If it is the lack of extension that is causing the problem, I do not control the server and I cannot get the extension added to the file names. Is there any manipulation I can do in the ImageWorker class to add the .png extension before it is sent to the ImageView and cached?
EDIT: If I save the file directly to the device and then display the image, it has transparency, even without a .png extension, so my assumption was incorrect. So, the question I have then, is why does it lose transparency when using the ImageWorker class?
I'm developping a mobile application using C++ Builder. I wanted to change the Bitmap of a FireMonkey TImage using the function LoadFromFile():
MyImage->Bitmap->LoadFromFile("My Image location");
I added the pictures to the project but I can't find the location of my Bitmap files. Does it exist a function or a parameter to find the location of these files?
I found why my Picture loading failed. I tried to use a .bmp file which is only supported on Windows and OSX. I worked with the instruction given by Kerem D here. I converted my picture to a PNG format and now it worked. Thank you all for your answers!
I am trying to follow the link below for the code for a Image viewing app in android.
android image "viewer" app
But I am getting an error with the r.raw.image1. (also on raw.image2 and image3). I have saved the images in the asset folder. Error says raw cannot be resolved or is not a field. I have checked various documentations for this but am unable to understand what i am doing wrong. The code is exactly the same as in the above link.
Try to save your image into res/raw folder.
I have the following code to remove a file on a PhoneGap / Cordova Project:
window.resolveLocalFileSystemURI(fileUrl, function(entry) {
entry.remove(that._onFileDeleteSuccess, that._onFileDeleteErrorError);
}, that._onFileDeleteErrorError);
The code executes file and the _onFileDeleteSuccess callback is fired.
However when I go to look in the Photo Library on the iPhone, the file is still there.
In addition to this, if I then capture another file, the new file name seems to be the same as the old one, and you even see the old file if you bind the URL of an img element to the newly captured path.
Any ideas? It's as if the app thinks the file has been deleted, but the OS is not actually removing the file.
Turns out the problem is just in Icenium ION on iPhone... once the app was built with provision, all seems to work as expected now.