bmp

creating .bmp image file from Bitmap class

白昼怎懂夜的黑 提交于 2019-12-23 18:53:43
问题 I've created an application that uses sockets in which the client receives the image and stores the data of the image in Bitmap class.... Can anyone please tell me how to create a file named myimage.png or myimage.bmp from this Bitmap object String base64Code = dataInputStream.readUTF(); byte[] decodedString = null; decodedString = Base64.decode(base64Code); Bitmap bitmap = BitmapFactory.decodeByteArray(decodedString, 0,decodedString.length); 回答1: Try following code to save image as PNG

How do I re-set a BMP file's resolution (DPI) indicator?

浪子不回头ぞ 提交于 2019-12-23 17:33:05
问题 I have a BMP tagged as 299 DPI resolution. I'd like to change that to 99 DPI. Importantly, the DPI marker in a BMP has no structural meaning. An image has a certain width and height in pixels . The displaying application can show the image at any width in inches. So, the DPI is just a hint. However, I am dealing with some third-party software which behaves differently depending on this marker, so I need to re-set it. I will appreciate suggestions on how to do this programmatically in Java, as

Converting 32 bit bmp to 24 bit

爱⌒轻易说出口 提交于 2019-12-23 15:04:04
问题 I have a System.Drawing.Image screenshot file. I cast it to bmp, but the problem is that it makes a 32 bit bmp, while I need a 24 bit one. How can I convert it to 24? 回答1: try this code: public static Bitmap ConvertTo24bpp(Image img) { var bmp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); using (var gr = Graphics.FromImage(bmp)) gr.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height)); return bmp; } 来源: https://stackoverflow.com/questions

How can I add a transparent PNG as a toolbar icon?

送分小仙女□ 提交于 2019-12-23 13:06:30
问题 My intention is to create a toolbar in Win32 containing a transparent icon. I have tried the following code to create a simple toolbar with one button having a custom image: // Create the toolbar HWND hToolbar = CreateWindow(TOOLBARCLASSNAME, NULL, WS_CHILD | TBSTYLE_FLAT | TBSTYLE_AUTOSIZE | TBSTYLE_LIST | CCS_BOTTOM, 0, 0, 0, 0, hwnd, NULL, ghInstance, // <-this is the HINSTANCE of the application NULL); // Set the font (this cannot be the problem) SendMessage(hToolbar, WM_SETFONT, (WPARAM

C# Free Image file from use

拟墨画扇 提交于 2019-12-23 13:05:30
问题 i have a temp image file which i open with Bitmap CapturedImg = (Bitmap)Image.FromFile("Item/Item.bmp"); and because is temp i want to replace it with another image for further use, but the program still using that image and i cannot do anything. How to let go from the image in order to be replaced? 回答1: I had a similar problem and could not use using, since the file was overwritten by some asynchronous code. I solved the issue by making a copy of the Bitmap and freeing the original one:

Why does calling istream::tellg() affect the behavior of my program?

岁酱吖の 提交于 2019-12-23 12:29:05
问题 I am trying to convert a 24 bit bitmap image into grayscale. #include<iostream> #include<fstream> #include<conio.h> #include<stdio.h> using namespace std; class pixel{ public: unsigned char b; unsigned char g; unsigned char r; void display() { cout<<r<<" "<<g<<" "<<b<<" "; } }p1; using namespace std; int main(){ unsigned char avg; fstream file("image.bmp",ios::binary|ios::in|ios::out); int start; file.seekg(10); file.read((char*)&start,4); file.seekg(start); int i=0; while(!file.eof()){ cout<

How to create a BMP file from raw byte[] in Java

我的未来我决定 提交于 2019-12-23 09:04:29
问题 I have a C++ application which communicates with a camera and fetches raw image-data. I then have a Byte[] in C++, which i want to send to Java with JNI. However, i need to convert the raw Byte[] to an real file format(.bmp was my first choice). I can easily do this if i write it from C++ to an file on the hard-drive, using BITMAPFILEINFO and BITMAPHEADERINFO, but i do not know how one would go about sending the entire-format to Java. Then i thought about sending only the raw byte[] data

Can a .BMP file be stored in an HTA (HTML/VBScript)?

China☆狼群 提交于 2019-12-23 07:29:18
问题 I've noticed in a backup of my FireFox bookmarks that the icon which is displayed to the left of each entry is held as a character stream in the A tags. For example: ICON="data:image/png;base64,iVBOR [data removed to shorten example] rkJggg==" I have 3 BMP files (2 are 4x20 (249 bytes) and 1 is 102x82 (24.7 KB)) that I would like to hide within my HTML Application so they don't get lost. The larger one appears 3 times in the style tag as follows (1 occurrence shown): <style type="text/css">

How to use ColorQuantizerDescriptor?

丶灬走出姿态 提交于 2019-12-22 18:45:15
问题 Following the idea of @PhiLho's answer to How to convert a BufferedImage to 8 bit?, I want to use ColorQuantizerDescriptor to convert a BufferedImage , imageType TYPE_INT_RGB, but RenderedOp#getColorModel() is throwing the following exception: java.lang.IllegalArgumentException: The specified ColorModel is incompatible with the image SampleModel. at javax.media.jai.PlanarImage.setImageLayout(PlanarImage.java:541) at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878) at javax

How to get bmp image from from binary blob data with php

a 夏天 提交于 2019-12-22 13:59:20
问题 I'm trying for 2 days to find a way to retrieve some images from a database. They are saved as a binary string (I read the term somewhere, but frankly never heard before). Most of the images are in .jpeg format and is easy to get and save to a file. but my problem is the .bmp images. For some reason i can't show then. For now, i'm using a simple code just to get the image and save it to a file: $img = $row['image']; file_put_contents("file.jpeg", $img); //Doesn't matter what format i put