628 questions
0
votes
0
answers
28
views
Android : Scaled image issue with BitmapFactory
I'm trying to draw a mipmap in a canvas using
canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.keyb_style_02),
0, 1445, null);
On a XHDPI screen it works
On a XXHDPI screen, the ...
1
vote
0
answers
58
views
BitmapFactory.decodeStream() no longer works with GIFs in SDK 35?
For a long time I've been using Picasso to load images into my ImageView. I noticed that on newer devices (Android 35+) the behaviour of BitmapFactory.decodeStream() has changed to now return null for ...
0
votes
0
answers
318
views
.Net Maui byte[] to Bitmap not working properly
I am using byte[] to Bitmap to print tickets on a printer in image form. However, the printed receipt shows only a line instead of the image.
Can anyone help where the code is wrong?
var img = ...
0
votes
0
answers
154
views
Android app unable to decode images for some users
I have an app that reads and enhances photos. Recently I (forced by Google) updated my app to use sdk 33. When I released it I began to get reports of errors. For these users it will not read any ...
0
votes
0
answers
83
views
Bitmap Compression Error thowing in android 13 oneplus and oppo 5g devices in android
when compressing image in working in oneplus and oppo android 13 5g Phone thowing error
[enter image description here](https://i.sstatic.net/LkbS7.png)
code :
@RequiresApi(Build.VERSION_CODES.O)
fun ...
1
vote
2
answers
93
views
How to draw oval shape (rectangle with round corners) as text background using Paint and Convas in Android java
I am trying to add an oval background to my text according to its size using Paint. There are a few problems in my code.
I want to draw rectangle with round corners instead of the circles.
Its size ...
2
votes
0
answers
199
views
Draw performance in canvas
I am using draw function in my app
public void draw(Canvas canvas) {
if (canvas != null)
canvas.drawBitmap(animation.getImage(), x, y, null);
}
This function is further invoked in main ...
0
votes
1
answer
507
views
(Kotlin - Set ImageView with online URL svg image) D/skia: --- Failed to create image decoder with message 'unimplemented'
I'm making a little geography app where I wish to display a country's flag (svg).
The flag image resources are online link (in svg format).
Eg: Albania Flag - > https://flagcdn.com/al.svg
This is ...
0
votes
1
answer
86
views
API request returning error code 400, when i try to decode the InputStream to Bitmap before the Retrofit enqueue
I'm trying to send the POST API request to the Server like below and I'm getting the successful response code - 200, but when I try to decode the InputStream to Bitmap, then only the API requests get ...
0
votes
1
answer
122
views
Why are RGB values lost if Alfa=0, when saving in png format?
when i create Bitmap
Bitmap newBitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888);
and edit pixels with Alfa (1-255)
newBitmap.setPixel(0, 0, Color.argb(255, 50, 100, 250));
and save to ...
1
vote
0
answers
543
views
Method to decode partial JPEG byte array in Android
I'm working on an Android app where I have a byte array of a JPEG image and need to display it. Currently, I'm decoding it in Android with this code:
Bitmap bitmap = BitmapFactory.decodeByteArray(...
0
votes
2
answers
1k
views
How to determine if BitmapFactory.decodeStream has finished decoding the image from a socket InputStream?
I'm developing an Android app that receives an image via BluetoothSocket and I'm trying to retrieve its Bitmap by using the BitmapFactory.decodeStream() method, so something like:
// Create ...
0
votes
0
answers
55
views
Android: Heavy recyclerview Bitmap
My app loads alot of images as Mainscreen has recyclerview with images, and once user click on any item it would load more images in a new activity with it's own recyclerview.
now cuz of these images ...
0
votes
2
answers
273
views
android how to scale down a bitmap and keep its aspect ration
using 3rd party library which returns a bitmap. in the app it would like to scale down the bitmap.
static public Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) {
int width = ...
0
votes
1
answer
216
views
Convert Java Code of Bitmap into C# code In Console app
I am trying to convert Java code into c#
So here is Java code
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 1;
options.inPreferredConfig = Bitmap.Config.ARGB_8888;...
0
votes
0
answers
112
views
Creating a Cropped bitmap without creating a new bitmap
I need to figure out a way to get a bitmap cropped without creating another bitmap that is already present.
I have two bitmaps
int width = 50;
int height = 50;
//Bitmap A
bitmapA = Bitmap....
1
vote
0
answers
692
views
BitmapFactory.decodeStream leads to : D/skia: --- Failed to create image decoder with message 'unimplemented'
I'm trying to download an image from a URL by creating a Bitmap using
bitmapFactory.decodeStream(InputStream) and then imageView.setImageBitmap(bitmap) but I am always getting this error:
D/skia: --- ...
1
vote
1
answer
436
views
BitmapFactory.decodeFile() returning null for existing image
I am facing an issue now.
Why Bitmap.decodeFile() method is returning null?
I tried with the following advice.
but the above advice doesn't help me.
For directories reference
Code:
private File ...
3
votes
1
answer
681
views
Android: BitmapFactory changes dimensions of image when decoding from ByteArray
I am converting an android Image captured in my application to a bitmap. I am doing this by getting the image buffer from the pixel plane of the image and then using BitMapFactory to decode it into a ...
1
vote
1
answer
411
views
BitmapFactory returns null bitmap for ARGB byte array (Android)
Newbie question. I have a byte array (of total length 1920 X 1080 X 4), with every 4 bytes holding constant alpha value of 0x80 (~ 50% translucency) and RGB triplet, I would like to convert it to a ...
1
vote
1
answer
373
views
How get resized bitmap in decodeResource
I'm trying to decode a drawable resource into a bitmap like below.
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = true;
int ...
0
votes
0
answers
113
views
Android Studio decodingFile not working, how to proceed?
camera.java
final File file = new File(getExternalFilesDir(null) ,"/CCA_" + new SimpleDateFormat("yyyy-MM-dd_HHmmss", Locale.getDefault()).format(new Date()) + ".jpg");
...
1
vote
1
answer
1k
views
byte array to bitmap returns null
I have a small program that takes a Chair.jpg and converts it a bitmap. The reason for this is to change the color type of the pixels to the format of BGR_888 (which I got from this stack overflow ...
0
votes
0
answers
88
views
My old picture app quits working on Android 11 S20. BitmapFactory has outWidth at -1
My app takes a picture then compresses if necessary. It gets an error on new s20 phones.
BitmapFactory.Options scaleOptions = new BitmapFactory.Options();
scaleOptions.inJustDecodeBounds = true;
...
0
votes
0
answers
42
views
Android - BitmapFactory treats all images as landscape
I want to load image bytes into ImageView using BitmapFactory with this code:
ImageView imageView = findViewById(R.id.photo_view);
imageView.setImageBitmap(BitmapFactory.decodeByteArray(imgBytes, 0, ...
0
votes
0
answers
46
views
generate list of bitmaps from path for painting them on canvas is slow
I've list of png stored on my smartphones:
image001.png, image002.png, ..., image175.png while each image is 200-250KB.
I would like to draw them on canvas. Thus I guess I need to convert them to ...
0
votes
0
answers
128
views
Java: problem when bitmap.setPixel() replaced by bitmap.setPixels()
I have the following code:
Bitmap bitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_4444);
for (int y = 0; y < HEIGHT; y++) {
for (int x = 0; x < WIDTH; x++) {
...
0
votes
1
answer
3k
views
I tried to view an image from /storage/emulated/0/Pictures using BitmapFactory - but see error permision denied [duplicate]
I started a new project in Android Studio with: empty activity, Java, API 29, Android 10.0 (Q)
I added permissions to AndroidManifest.xml
<uses-permission android:name="android.permission....
0
votes
3
answers
547
views
Android BitmapFactory.decodeByteArray get the photo width/height is exchanged than iOS UIImage(data:)
I get a base64 string from the server, then I parse it to image, on Android side, the image is rotated to 270 degree, its width/height is exchanged than iOS side. Any idea? Thank you. Here is the code:...
0
votes
1
answer
174
views
Image dimensions obtained from bitmapOptions.outWidth and bitmapOptions.outHeight are exchanged
I am trying to obtain the dimensions of an image using its URI using the code below. However, for some images (photos taken by phone camera in the portrait mode - an example photo below) the obtained ...
0
votes
0
answers
32
views
android arrays can't store 2.4MB worth of data
I was trying to make a custom animation player by rapidly switching images and extending view, so I had to load the BitMaps into an array, the whole 142 images are only 2.4MB in size, and I even ...
0
votes
0
answers
147
views
BitmapFactory.Options inSampleSize documentation confusion
Following is the code from the official Android documentation.
https://developer.android.com/training/camera/photobasics
private void setPic() {
// Get the dimensions of the View
int targetW = ...
-1
votes
1
answer
2k
views
BitmapFactory.decodeFile e/bitmapfactory unable to decode stream java.io.filenotfoundexception EACCES (Permission denied)
I tried to take a picture from storage, and display it in ImageView using BitmapFactory.decodeFile but i found error unable to decode stream java.io.filenotfoundexception EACCES (Permission denied), i'...
0
votes
1
answer
10k
views
Set Bitmap on ImageView - Failed to create image decoder with message 'unimplemented'
I have a Spring Api with two methods: one of them return a List<byte[]> as a JSONArray, and another method that returns a byte[].
When I call Volley multipart request to return a byte[], I can ...
0
votes
0
answers
287
views
How to check if BitmapFactory.decodeStream() has fully downloaded an image?
I'm using BitmapFactory.decodeStream() to download images on a background thread.
Here is the code:
URL url = new URL("https://....");
final Bitmap image = BitmapFactory.decodeStream(myUrl....
3
votes
1
answer
602
views
How to get Bitmap with actual size of it, in Bitmap variable irrespective of deivce I am using
I have a jpg image of size 1080*1080 in my drawable folder, when I am storing it in a Bitmap variable the size of the bitmap is not showing as 1080*1080, it is showing based on the device I am using, ...
0
votes
1
answer
187
views
Loading smaller version of an image for performance Android
I have an image (1.84MB) to load and I want to load a smaller version of it to gain time, I also don't want to store a smaller version of it. For info, these files are located in a removable SD card, ...
1
vote
0
answers
413
views
Can I generate Bitmap from R.mipmap.ic_launcher_round
I try to get bitmap to generate from the R.mipmap.ic_launcher_round
val bitmap = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher_round)
Why did it just return null?
2
votes
2
answers
1k
views
Android 10: BitmapFactory.decodeFileDescriptor returns null
On an emulator running Android 10, when I use decodeFileDescriptor on a FireDescriptor as shown below, the bitmap is created fine. But when I try to set the options and then get the bitmap using that ...
1
vote
0
answers
167
views
BitmapFactory.decodeFile returns "" for valid file path
I have an image that is saved in this place
/data/user/0/com.package.name/files/3_20200302_1915403011639805937138468.jpg
I want to load it in a bitmap as below
val bitmap = BitmapFactory.decodeFile(...
0
votes
2
answers
141
views
How to send screenshots from C# server to android client?
I created socket connection between Server and Android Client and sent Images as byte Array but I can't find a way to decode byte Array in android.
Every time I try Image = BitmapFactory....
0
votes
1
answer
935
views
Can not read image with BitmapFactory.decodeFile
Bitmap size is only 49 KB.
I have permissions in my AndroidManifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android....
0
votes
2
answers
153
views
How to decode a scaled bitmap from URL efficiently
I am designing an app which has to deal with large number of bitmaps with huge size from server. There are ways to decode
Option 1:
Create a buffered inputstream from image url
Decode only the bounds
...
0
votes
3
answers
1k
views
BitmapFactory decodeFile returning null
I am trying to take a photo using camera and then trying to save to gallery and decode the stream using BitmapFactory but it returns null and also photo taken is not saved to gallery.
So two things ...
0
votes
1
answer
683
views
Android Select Image From Gallery java.lang.NullPointerException: Attempt to invoke virtual method 'boolean Bitmap.compress()' on a null object
I'm creating image upload from pick gallery to server. one week ago everything work fine, but today didn work and giving this error.
java.lang.RuntimeException: Failure delivering result ResultInfo{...
0
votes
0
answers
113
views
What is the correct URI to send to handleSamplingAndRotationBitmap?
I have the common problem of display a picture in the correct rotation. My images are stored on a server. I call an image and display it in my app. Each image is rotated. So I found a correction with ...
-1
votes
1
answer
438
views
Merging png files programmatically
I realise this topic has many posts and I have used them to get this far but I feel I need a little extra to get over the hill as none of them demonstrate the use of arrays for this process.
I am ...
2
votes
0
answers
572
views
Create a pdf in Xamarin.Android using iTextSharp with a Letterhead
I successfully managed to create a pdf file using iTextSharp with a table inside it. I am trying to add in on top a letterhead image from inside the drawable folder
I have tried to add it using
...
0
votes
0
answers
85
views
E/BitmapFactory (No such file or directory) Android API25
Good afternoon, I have the following code in Android for take a photo and show in ImageView, the file photo is in the path when I check with filemanager, but dont show in ImageView and have the ...
0
votes
0
answers
123
views
Nativescript Bitmap Factory - slow fps animation
I'm trying to make interactive bitmap animations using Bitmap Factory plugin for NativeScript. I use Vuejs template.
Github repo:
https://github.com/sylwesterdigital/nativescript-bitmapfactory-anims....