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?
Related
i'm creating a simple html page using droidEdit in Android, simple as that.
In this page there's a div with a background.
This background is an image stored locally, but the url must be (for a number of reasons) an absolute path, not a relative one, and in particular one like this: file:///sdcard/assets/images/test.gif
Now, if i open my page opening Chrome and navigating to file:///sdcard/index.html everything works perfectly, and i can see my div with his nice animated background.
My problem is that if i instead open index.html directly from the file manager, Chrome is launched and it correctly display index.html but the div shows no background at all.
I'm not an expert in how Android system works underneath the surface, but since the same code (with a different file:/// path, of course) works in Windows, i suspect that Android somehow uses a different url/uri system to handle locally stored files.
Is there any way to set the right (absolute) path of test.gif to make the css load it correctly, when i open index.html directly from the file manager?
Thank You in advance
Accessing local images works when navigating directly to the file in chrome. It won't work when opening the html file from another page because of security rules imposed by browser. Checkout the full details here: https://blog.chromium.org/2008/12/security-in-depth-local-web-pages.html
It can be fixed by base64 encoding the image using any online tool(search for base64 image) and using the result as background:
body{
background: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUTExIVFhUXGRgYFxgXGBcXFhgXFxUXFxcXGBcYHSggGBolGxUXITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGxAQGy0lICYvLi0tLS0tLS0tLystLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIA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ltek0vLnkQJIg4x18NlheSvI59+jRKTUbQHdd6kZMZERJ6zA5pUauCAZcJYBuTBzj0CwvIRbtIVZpVQ97MV26gwsOrJycb5gdU+4lfFow2V5eXo4ckvwWvsfD85bKbxnirTh7SJnJ+Xy5Sqle1+83SAfsM8x1zsvLyhHb2bl0acMrfEqBswBIecQGjOozyGcJ3c0y9/wALLaNNmqnpzLNBd8Tlqc7f6cl5eVq1/glKWwK7rRTpU55GpjY6zgn/AOIHutbCx1hzzIYwSeUk4aBGdyJjkvLylHqxYv4/79k1KiC8VHTpe5rWcpcMcsYA9MKxXTKT6Omo4BtQaA48pyD5ggLK8lkvR0pNlNfwRra2l5LRTo/Eq57xIaXEN6HvNaD1cmPZ2lW0AhjG63RJHyUmg6omSdXyyTMNdyK8vKkHyhFv2LKT43/Q44dUOkt0ul5aMgTpHe2Bgciek+Ce2sNgAz5ecfzyXl5Jjk3Nr6Qrk0n/AGR9orP4jmDGQTpMQTgnl0HhukN1ww9w1HAVc/5YHdbnDIy0wY1RywvLybyF8tGLIttmLmKYy54BAhrNbtIaADI2bnfqhrhprNDAZ1OIwCNRIEYO5g8uqyvKUNv+xOJ5tGnQwXCpUPzuHygZYWg7OOTJOMY6oW3vHtf3st1AGBEdR5wZnmDPVeXkJPYr7G9ag0kBzAWkzMSBAAJPTrKDcxrXbnW505yG6+YI/wBQzO0Ly8pQ6s5m1pc99xP9paZzmM59UzuqTWuDWzJG+I1kAxPMwD4ZHkvLy5Aj0Am7FN0ZDW5EQC0jY9TucdQvVajS9xBDQcQNtpI25umMbALy8i36OZmnEanuJgNa2DAeWxOPDHsk12Q97nOOSZ6Y5fSFleQjti2f/9k=')
}
Or uploading the background image to any image hosting service and reference the url.
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!
I'm working on an app, using ionic2.
I'm storing a set of images that I downloaded from the server in the dataDirectory to save mobile traffic when the app is used without wi-fi.
Now, I would like to display them inside my template.
Is there a recommended way how the image should best be inserted?
I tried giving the ion-img or img-tag
the complete path (file.dataDirectory + “myImg.jpg” -> "file:///data/user/0/io.ionic.starter/files/myImg.jpg”
(stored in my imgPath variable, the path is written after the platform.ready event), but only a broken image symbol is shown. When accessing images from my assets folder I do not encounter any problems, but how can I access the dataDirectory’s images?
<img width=“200” height=“200” [src]=“imgPath” *ngIf=“imgPath”>
Or do I have to read each image from the dataDirectory and store them in a local variable as a base64 string?
There are many reason for showing broken image in IONIC.
If you are using live reload then sometime images are shown as broken image. You can run directly to see if it resolves your issue.
If you want to use base64 image, either you can save it SQLite or in local variable which may resolve your issue.
Working on an Android app that downloads images in JPEG format internally and then displays them within the app.
The issue is that the default Gallery App, shows those images as it scans entire storage for JPEG or PNG files. That causes confusion w/ some users as they do not expect to see internal app images next to their family photos.
My initial thoughts are to rename the extension. But before that, does anyone know if perhaps a simpler way exists by using permissions?
I am using .net web services and I am having list of folders and files. I am successful in retrieving list of files(.jpg Image, .pdf, .TIF) but can anybody let me know how we can open .jpg, .pdf, .tif or other files format which I am getting from web services. Is there any specific code to open particular format or we can use path (/) to open that particular file?
Thanks.
if you need to download and display an image, check my answer on this post, that is probably what you are looking for. Common extensions for displaying images in Android are .png and .jpeg, you will not be able to show a .pdf file using an ImageView. You can also use the method mentioned in my answer inside an AsyncTask to perform the download in background and then update your UI thread