bmp

java Buffered Image : Detecting black pixels

跟風遠走 提交于 2019-12-05 05:23:28
I have this simple code to go through a 24bit color windows bmp file BufferedImage mapa = BMPDecoder.read(new File("maps/map.bmp")); final int xmin = mapa.getMinX(); final int ymin = mapa.getMinY(); final int ymax = ymin + mapa.getHeight(); final int xmax = xmin + mapa.getWidth(); for (int i = xmin;i<xmax;i++) { for (int j = ymin;j<ymax;j++) { int pixel = mapa.getRGB(i, j); if (pixel == 0) { System.out.println("black at "+i+","+j); } } } However, when testing on a completely black image, I get this value at pixel : -16777216 . I was hoping to get a 0x0. How can I test for black pixels (or any

Decompression stops inbetween and output file filled with zeros(BLACK PIXELS)?

我是研究僧i 提交于 2019-12-05 02:56:57
问题 I am trying to apply DCT(discrete cosine transformation) compression on a bmp(bitmap) file. I have a c file which i am running in Turbo C++. This is not actually compressing but i was trying to implement the DCT and IDCT. The code is as follows: /* the image to be compressed is a bmp with 24 bpp and with name "college4.bmp" of dimensions 200*160 ie 25*20- 8*8 blocks o/p is college2.dat format: 8 bit signed integers starting rowwise from 0,0 to 8,8 the coefficients order is blue,green,red for

Does the delphi TBitmap support an alpha channel

只谈情不闲聊 提交于 2019-12-05 02:16:33
问题 I'm hearing people say that it is not. However, I created a TBitmap and cleared the entire area by For I := 1 to bmp.Width do For J := 0 to bmp.Height do bmp.canvas.Pixels[I,J]:= $00000000; Then I drew anti-aliased text onto the bitmap and saved it to file. Upon opening it in gimp it shows the transparency information. Does anyone have a definitive answer on this and if it does work then more information on how it works? I've tried playing around with the last byte and I'm not getting the

Converting animated .gif file into a .bmp strip

。_饼干妹妹 提交于 2019-12-04 21:21:37
I was wondering if someone can direct me or guide me in order to use a .gif image and convert it into a .bmp strip image file. First, you need to get the gif's size. Then you need to find out how many frames there are. After that you need to create a new image with Height = original height, and Width = Frames * Gif Width. Then you must paste the original Gif's frames into the strip like so: Frame N starts at pixel N*Width. That is if you're making a horizontal strip. And here is the complete code for a console application: using System.Drawing; using System.Drawing.Imaging; foreach (var arg in

Creating a custom file-type in C++

人盡茶涼 提交于 2019-12-04 20:21:01
I am making a level editor that needs to output a custom map file for use with source code that I will write for a graphics library. My question is: What do I need to bear in mind when deciding how to structure a custom file type? Also how can I encode a standard bitmap image into my file (the tile set) so that it can all be contained in a single file rather two files; the map file and tile set (.bmp file). Thanks. First you need to design your file layer, you need fixed size data to determine how to decode your variable data, for example, the first four bytes you read could tell how many

C++ OpenCV imdecode slow

北城以北 提交于 2019-12-04 18:58:54
I send a byte array of an image from C# to a C++ Library. I decode the image with OpenCV (Version 3.3.1) BMP images are fast in decoding but JPEG images are slow. How i can speed up the decoding time for JPEG images? (Multithreading, GPU, ...?) Performance of decode --------------------------------------------------------- | Resolution | Format | Size | Duration | | --------------------------------------------------------- | 800x600 | BMP | 2MB | 0.7 ms | | --------------------------------------------------------- | 800x600 | JPEG | 10KB | 4 ms | 500% slower | ---------------------------------

Padding in 24-bits rgb bitmap

 ̄綄美尐妖づ 提交于 2019-12-04 18:31:52
问题 could somebody explain to me why in 24-bit rgb bitmap file I have to add a padding which size depends on width of image ? What for ? I mean I must add this code to my program (in C): if( read % 4 != 0 ) { read = 4 - (read%4); printf( "Padding: %d bytes\n", read ); fread( pixel, read, 1, inFile ); } 回答1: Because 24 bits is an odd number of bytes (3) and for a variety of reasons all the image rows are required to start at an address which is a multiple of 4 bytes. 回答2: According to Wikipedia,

python bmp转换为jpg 并删除原图

谁都会走 提交于 2019-12-04 18:06:56
# coding:utf-8 import os from PIL import Image # bmp 转换为jpg def bmpToJpg ( file_path ): for fileName in os.listdir(file_path): # print(fileName) newFileName = fileName[ 0 :fileName.find( "_" )]+ ".jpg" print (newFileName) im = Image.open(file_path+ " \\ " +fileName) im.save(file_path+ " \\ " +newFileName) # 删除原来的位图 def deleteImages ( file_path , imageFormat ): command = "del " +file_path+ " \\ *." +imageFormat os.system(command) def main (): file_path = "D: \\ VideoPhotos" bmpToJpg(file_path) deleteImages(file_path, "bmp" ) if __name__ == '__main__' : main() 来源: CSDN 作者: 顽石⚡ 链接: https://blog

C++: .bmp to byte array in a file

蹲街弑〆低调 提交于 2019-12-04 15:31:26
Yes i have been through the other questions that are related to this, but i found them not much help. They were some help but i am still a bit confused. So here what what i need to do: We have a 132x65 screen. I have a 132x65 .bmp. I want to go through the .bmp and separate it into little 1x8 columns to get the binary of that 32-bit column. Then do that 132 times across, and do that 9 times down. Anything that is not white should be counted as a bit. example: If the top left pixel of the picture is any color that is not white and the 7 pixels below that are white then that would be the first

How to read bmp files in tensorflow?

霸气de小男生 提交于 2019-12-04 06:46:52
问题 I'm trying to read BMP files in TensorFlow in the following way: reader = tf.TextLineReader() _, value = reader.read(filename_queue) filename, label = tf.decode_csv(value, [[''], [0]]) im = tf.decode_raw(tf.read_file(filename), tf.uint8) The error is the following: E tensorflow/core/client/tensor_c_api.cc:485] Input to reshape is a tensor with 44200 values, but the requested shape has 750000 [[Node: batch_processing/Reshape = Reshape[T=DT_UINT8, _device="/job:localhost/replica:0/task:0/cpu:0"