bitmap , How many addressable bits are in 4 kilobytes of memory?

## Question:

Tag: bitmap

I have come across the following statement in a solution for a problem:

We have 4 kilobytes of memory which means we can address up to 8 * 4 * 2^10 bits.

Where is the 2^10 coming from? I would have thought that we could address 8 * 4 * 1000 bits.

For reference, the question is:

You have an array with all the numbers from 1 to N, where N is at most 32000. The array may have duplicate entries and you do not know what N is. With only 4 kilobytes of memory available, how would you print all duplicate elements in the array?

1 kilobyte is supposed to be 1000 bytes whereas 1 kibibyte is 2^10=1024. However, kibi* and related units never really caught on, so "kilobyte" almost always means 1024 bytes in practice.

# Related:

## How to convert any image to bitmap image and store in MySQL database using PHP?

How to convert any image to bitmap image and store in MySQL database using PHP? I want to store an image in a database. How to convert any images to bitmap image. <?php \$target_dir = "uploads/"; \$target_file = \$target_dir . basename(\$_FILES["fileToUpload"]["name"]); \$uploadOk = 1; \$imageFileType = pathinfo(\$target_file,PATHINFO_EXTENSION); // Check if...

## How to display very long Bitmaps in Android?

android,image,bitmap
Suppose you have an image that measures 500x6000 pixels. I tried loading such an image in my Android app but soon found out that there are maximum dimensions for bitmaps (as described here) Now, I still would like to be able to show such an image. How can I do...

## Errors in bitmap creation in Java

java,bitmap,drawing,bmp
I'm trying to create a bitmap from a 2d array of pixel values. I've found some code on the internet (taken from http://forum.codecall.net/topic/62457-creating-a-bmp-image-in-java/): import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class BMP { private final static int BMP_CODE = 19778; byte [] bytes; public void saveBMP(String filename, int...

## Bitmap quality using glReadPixels with frame buffer objects

android,opengl-es,bitmap
I have the following issue when exporting a bitmap from frame buffer object on Android using OpenGL 2. I have an image loaded into OpenGL and shown on the screen. The loaded image is bigger than the actual screen, thus I do some matrix manipulation to fit it on the...

## When I load a new image in a TBitmap I must destroy the existing one first?

delphi,bitmap,delphi-2009

## How to go from raw Bitmap data to SDL Surface or Texture?

c++,bitmap,textures,sdl,surface
I'm using a library called Awesomium and it has the following function: void Awesomium::BitmapSurface::CopyTo ( unsigned char * dest_buffer, // output int dest_row_span, // input that I can select int dest_depth, // input that I can select bool convert_to_rgba, // input that I can select bool flip_y // input that...

## How to read a bitmap from the Windows Clipboard

c++,windows,bitmap,sfml
I am writing an extremely small C++ program to help me animate sprites. I'd like it to take data I copy to the clipboard from photoshop, manipulate it in my program, then overwrite the clipboard with the transform. The problem though is that I'm not sure how to read the...

## Java variable scope - copying bitmaps?

java,bitmap,scope,recycle
I'm trying to better understand how Java variable scope works and what exactly happens to the underlying data when we do something like the following in a method: this.variable = variable What exactly does this line do? Here is my actual problem: I'm loading Bitmaps to apply as textures in...

## Android - Drawing lines using bitmap on TouchImageView

android,bitmap
Basically I would like to draw lines on an image so that when that image is zoomed, the lines would also get zoomed proportionally, or any kind of interactivity like fling or zoom reset. I'm using TouchImageView as my ImageView and here's my code public class ParkA extends Activity{ @Override...

## Android Bitmap on Canvas from External File

android,canvas,bitmap,drawable
I use the following code to get a bitmap from the resources folder put it into a drawable and paint it to the canvas Drawable f = getResources().getDrawable(R.drawable.harris1); f.setBounds(a,120,a+200,270); f.draw(canvas); I want to be able to get the bitmap from my pictures directory on my device and paint it on...

## Bitmaps not scaling correctly AS3

actionscript-3,flash,bitmap,bitmapimage
I was experimenting with bitmaps and created an alpha mask. When i test the program in full screen, it works fine however when I re-size the screen, the bitmap alpha masks doesn't seem to scale correctly. Below are illustrations of my issue. The bitmap alpha mask is shown as a...

## canvas drawBitmap only part of image

android,android-layout,bitmap
How do I draw a part of a bitmap using canvas with canvas.drawBitmap() ? For example I have the following bitmap And I need to draw only this part Is it possible to do with canvas.drawBitmap or I need something else?...

## BitmapFactory.DecodeByteArrayAsync JPEG is 77KB resulting Bitmap is 1.6MB

android,bitmap,xamarin,jpeg
I'm downloading some regular JPEG files and I have verified the file size. They are 77KB and can be viewed in my browser. ImageBytes.Length verifies this file size. However, imageBitmap.byteCount is 1638400 bytes. What am I missing? BitmapFactory.DecodeByteArrayAsync creates usable files, but they are huge. public async static Task<Bitmap> GetImageBitmapFromUrl(string...

## Android How can I using Cursor get image and video thumbnails in my direct path both?

java,android,bitmap,cursor
How can I using Cursor get image and video thumbnails in my direct path in same cursor? I need get the image and video thumbnails in /DCIM/100ANDRO folder. But I just can separate to get image and video in at sd card all data. private ArrayList<ImageItem> getData() { final ArrayList<ImageItem>...

## Bitmap connection error

android,android-studio,bitmap
I'm making an android studio application which in one of its tabs has a rss feed and now with the addition of the image and bitmap code, whit it I try to put my image to imageview, to my adapter whenever I run my code it crashes: android.os.NetworkOnMainThreadException at android.os.StrictMode\$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147)...

## Clear Bitmap in Android

android,bitmap,xamarin
I create first chart using bitmap and canvas. How I can clear bitmap for drawing new chart? ImageView imageView = new ImageView(this); Bitmap bitmap = Bitmap.CreateBitmap(w, h, Bitmap.Config.Argb8888); Canvas canvas = new Canvas(bitmap); ... imageView.SetImageBitmap(bitmap); relativeLayout.AddView(imageView); ...

## Changing bitmap image on loop

java,android,bitmap
I have a canvas and I wish to change the bitmap image every 50 milliseconds. Basically what I'm trying to do is like a gif animation. As you can see there's 4 images and every 50 milliseconds I want it to change the image. the code below doesn't work and...

## CV_32FC1 to bitmap

c++,winforms,opencv,bitmap
I've an image loaded in a Mat. From this, I calculate the DFT, so in a new Mat I've the DFT stored (both the real and img. parts). Since here, I aim to draw the magnitude of the DFT. I've achieved this already with OpenCV, by calculating it, take it...

## winapi: from HDC to an HBITMAP

c++,winapi,bitmap,gdi
I would like to do something which I believe is fairly simple but since I am new to the winapi I am finding a lot of problems. Basically I have an HDC (which I am BitBlitting from a loaded Bitmap) and I am drawing a rectangle on it. Then I...

## Apply multiple effect on bitmap without saving it

android,image-processing,bitmap,textures,effect
My requirement is to load multiple Effect on bitmap. I am following apply-effects-on-image-using-effects for it. I got success for applying the effect but My requirements is to give brightness effect separately. That means user can able to give Brightness effect after applying any other effect without saving the file. I...

## Android: int array set null but still in memory after GC

android,memory-leaks,bitmap
I tried to break it down to the main code regarding the pix array: public class BitmapProcessor { int[] pix; public Bitmap run(Bitmap b) { pix = new int[picw * pich]; bitmap.getPixels(pix, 0, picw, 0, 0, picw, pich); // do some stuff bm = Bitmap.createBitmap(picw, pich, Bitmap.Config.ARGB_8888); bm.setPixels(pix, 0, picw,...

## How to overlay bitmap over another bitmap at particular XY position

android,bitmap,android-canvas
I am working on a project where I have used canvas and user can touch move one bitmap overlay to another bitmap. When user presses save button then both bitmaps should merge and become a single bitmap. I have done all things and now merging two bitmap at XY position...

## How can I put a device-independent bitmap into the Windows clipboard using just direct WinAPI? (No MFC or other wrappers)

c++,bitmap,clipboard,alpha,dib
I've been trying to get this to work for awhile now, but I can't seem to figure it out, and hours of Googling has yet to reveal any useful results. I have an array of 32-bit pixels in RGBA order, and I want to create a device-independent bitmap from them...

## Android load image into imageview efficiently

android,bitmap,imageview,out-of-memory
I have next problem: To avoid OutOfMemoryError i'm loading my big images into ImageViews using Picasso in such way: public static RequestCreator picasso(final Context context, final int resourceId) { return Picasso.with(context) .load(resourceId) .fit() .centerCrop() .noFade(); } And in activity or fragment, i'm loading image into ImageView final ImageView backgroundImage =...

## Rounded Corner doesn't work on openFileInput Bitmap

android,bitmap
The Rounded Corner code works on both Volley NetworkImageView and the resource. But it doesn't work on the Bitmap from ApplicationContext. Here below is the code. public class ImageViewUtils { public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(output); final...

## Android video thumbnail is null

android,bitmap,thumbnails,video-thumbnails
So basically what I'm trying to achieve is that the user can choose to select an existing video or take a new one, but my bitmap has always a null value. @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_VIDEO_CAPTURE && resultCode == RESULT_OK ||...

## Android edit images on the fly

android,opencv,bitmap,android-bitmap,opencv4android
It seems that in Android there are no "easy" libraries for editing and save pictures, neither free or with licenses). Aviary is no longer available. I have to implement an app for Taking picture, edite with some effects on the fly (Vignetting contrast, brightness...), add some text and save. A...

## Takes 25+ Seconds To Save Bitmap From Camera To Phone

java,android,bitmap,camera,bytearray
I am making a camera app. There has been a host of issues getting orientation right because some phones don't write EXIF orientation data. Because of this, I get the bitmap, save it (since I don't think I should read EXIF data from the byte[]), then rotate the bitmap, then...

## How to convert an Image to Mat Android

android,image,bitmap,mat
I need to process Image for my Application. I get the Images for ImageReader. reader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(ImageReader reader) { Image mImage = reader.acquireNextImage(); //mImage to Mat here mImage.close(); } },null); But now, I need to convert those images in Mat. I know that I can pass...

## Convert Image 16bits grayscale to Bitmap 16bits grayscale (Constructor error)

c#,image,bitmap,grayscale,opencvsharp
I try to convert a Image (16bits grayscale) to Bitmap (16bits grayscale). This example doesn't works (Exception : ArgumentException) private Mat ToMat16bGrayscale(Image im) { Bitmap bmp2 = new Bitmap(im); } But this example works : private Mat ToMat16bGrayscale(Image im) { //Cast obligatoire la création ou la copie d'une bitmap ne...

## Paste pivot table as bitmap into Body of Outlook Appointment

excel-vba,bitmap,outlook,paste,appointment
Using Excel VBA, I'd like to make a small pivot table visible to Outlook users. I do NOT want to paste into a message body I DO want to paste into an appointmentItem Here is my code that creates the Appointment and copies Range to clipboard. How do I paste...

## Android: How to write a Bitmap to internal storage

java,android,bitmap,save,storage
I am making an app that gets images from a URL. I want to be able to store these images on the phone so that if the url is the same as before, the user won't have to wait for the image to load but instead the app will pull...

## take screenshot from layout and share via android

android,android-intent,bitmap
I use below code to take screen shot from my layout and share it via android intent but the captured screen shot in the selected app is not showing any thing. @Override public void onClick(View view) { shareBitmap(this,takeScreenshot()); } public Bitmap takeScreenshot() { try{ View rootView = getWindow().getDecorView().findViewById(R.id.lyt_main_report_activity); rootView.setDrawingCacheEnabled(true); return...

## Writing Byte Values in Bitmap Header To File

c++,bitmap,hex
I'm trying to write a bitmap header to file. For the moment, I just want to write the header without any pixel data. I'm basing the values on this, this, and this. I have the following function for composing a standard, uncompressed 24bit RGB bitmap header as a uint8_t: uint8_t*...

## How to display images from ObservableCollection in mvvm

c#,wpf,xaml,mvvm,bitmap
I'm still tyring to get my head around MVVM. I got stuck on displaying my images which paths are stored in an observableCollection. In the past I could make it would with code behind in the view but now when I'm trying to implement MVVM on my project and it...

## Convert Android image into a file that MATLAB can read

android,image,matlab,image-processing,bitmap
I´m working on a project related with image recognition using MATLAB and I'm currently using an Android app to help with some pre-processing steps. I thought it was going to be easy to work with matrices instead of bitmaps. I finally managed to finish my algorithm and to import it...

## fast converting Bitmap to BitmapSource wpf

c#,wpf,bitmap,copy,bitmapsource
I need to draw an image on the Image component at 30Hz. I use this code : public MainWindow() { InitializeComponent(); Messenger.Default.Register<Bitmap>(this, (bmp) => { ImageTarget.Dispatcher.BeginInvoke((Action)(() => { var hBitmap = bmp.GetHbitmap(); var drawable = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DeleteObject(hBitmap); ImageTarget.Source = drawable; })); }); } The problem is,...

## Save bitmap to app folder

android,bitmap
When my app first starts, it lets the user select a profile picture. This can be done taking a photo at the moment, or selecting it from the gallery. After the user gets a picture, this must be saved in the device's internal storage, and will be used in the...

## C# Memory Leak on on different machines

c#,memory-leaks,bitmap,garbage-collection
Background info I've developed a desktop application with Windows Form (C#) for scanning, previewing and saving images. The app behaviour while scanning is the following: Scan n images Get a Bitmap for each image and store it in a temporary file Show resized thumbnails as a preview Image memory management:...

## Out of memory exception occurred at Bitmap Shadder android

I am working on android application in which i am using Bitmap, but the problem is that sometimes it shows me an error of out of memory and my application get crashed. I am using bitmaps along with BitmapShadder, my code is given below where my application shows this error....

## How to get Bit Depth of a Bitmap on Mono For Android

bitmap,monodroid,android-bitmap
In .NET one way to check the bitdepth of a Bitmap image is using the Bitmap class like so: switch (bitmap.PixelFormat) { case System.Drawing.Imaging.PixelFormat.Format1bppIndexed: return 1; case System.Drawing.Imaging.PixelFormat.Format4bppIndexed: return 4; case System.Drawing.Imaging.PixelFormat.Format8bppIndexed: return 8; case System.Drawing.Imaging.PixelFormat.Format16bppArgb1555: case System.Drawing.Imaging.PixelFormat.Format16bppGrayScale: case System.Drawing.Imaging.PixelFormat.Format16bppRgb555: case...

## Android BitmapDecode in listview

android,string,listview,bitmap
I use the folowing to get a bitmap from my device and display it in a listview pic1="Harris1.jpg" pic2="Harris2.jpg" pic3="Harris3.jpg" Bitmap bmp = BitmapFactory.decodeFile("/storage/emulated/0/Pictures/" + pic1); Bitmap bmp1 = BitmapFactory.decodeFile("/storage/emulated/0/Pictures/" + pic2); Bitmap bmp2 = BitmapFactory.decodeFile("/storage/emulated/0/Pictures/" + pic3); Bitmap[] image={bmp,bmp1,bmp2}; for(int i=0;i<text1.length;i++) { item_details.setImage(image[i]); } this works fine but is...

## out of memory Error Unsolved

android,bitmap
I am taking the image from internal memory.and pasting it on the greator image in the merge function.after the 66 image the app is crashing badly and the error is out of memory . Do you have any idea why the app crashing and how to solve it.here the app...

## C++ Bitmap Resource (RT_BITMAP) and PNG Image Format

c++,bitmap,png
An application I'm developing displays various PNG images to the user in a window, and it works fine. My question is more on the grounds on HOW my PNG's are stored in the PE. Currently, the PNG's are stored in the executable as a resource, under the RT_RCDATA Resource Type,...

## Android - AlertDialog won't show BitmapDrawable

In my app, I'm downloading a small Facebook profile picture and show it in an AlertDialog (as BitmapDrawable) along with the user first and last name. Now, my problem is that on some devices the BitmapDrawable is shown in the AlertDialog (Android ~4.0) and on some it isn't (5.0 and...

## android Bitmap Subsampling of Image

android,listview,bitmap,subsampling
Im having problems with out of memory errors when displaying images in a listview from the SD Card I know its because I need to subsample the bitmap as they are large 8mp pictures and if I shrink them to 600 x 450 they load perfectly I load them normally...

## Generate bitmap from view

android,bitmap,android-annotations
When I get the bitmap from the DrawingCache of a view I get no error but I don't see a valid bitmap either. What am I doing wrong? The code I use to generate the bitmap: SharePhotoView sharePhotoView = SharePhotoView_.build(this); sharePhotoView.bind(mCatch); sharePhotoView.setDrawingCacheEnabled(true); sharePhotoView.buildDrawingCache(); Bitmap bitmap = sharePhotoView.getDrawingCache(); catchImage.setImageBitmap(bitmap); The code...

## JNI C++ to Java 32 bit image not showing properly

java,c++,colors,bitmap,jni
I have the following C++ code for JNI And the following Java code to create a 32bit bufferedimage, the sizes are also received through JNI Everything seems to work only that I have some weird colors in the image and I don't know how to get it right Result of...

## How to resolve Out of Memory Error on Bitmap in Android?

android,android-intent,android-activity,bitmap
I want to set an image in image view,I am retrieving the image path in my first activity and I am passing it via intent as a String to second activity.In the second activity I set the path to an image view,It is working properly , and I need to...

## Converting Text view to bitmap returns null

java,android,canvas,bitmap,textview
I am trying to make an image of dynamically added views in my activity. Can you please tell me what I am doing wrong, the bitmap returns null for some reason. Thanks, protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_share); TextView tv = new TextView(this); tv.setText("sadasdsadssad"); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(...