bmp

How to load .bmp file into BitmapImage class Tkinter python

不羁岁月 提交于 2019-12-11 08:33:06
问题 I'm unable to find any way to load .bmp file into Tkinter() so that I can use it in a canvas widget!Plz help me! from Tkinter import * from PIL import Image import ImageTk import tkFileDialog import tkMessageBox root=Tk() class lapp: def __init__(self,master): w=Canvas(root,width=300,height=300) w.pack() p=Image.open("001.bmp") tkimage=ImageTk.PhotoImage(p) w.creat_image(0,0,image=tkimage) App=lapp(root) root.mainloop() Its not showing any image on the canvas, its just blank! Btw I'm using

java create BMP image from pixel matrix and reverse

ε祈祈猫儿з 提交于 2019-12-11 07:43:26
问题 Have a task to generate BMP file from int RGB matrix and than read that matrix from BMP image. I've used this class to generate BMP file but it seems that it is hard to reverse this approach for getting rgbValues array from image: /** * Class for creating bmp images from the pixel matrix (an int matrix). * @author eafkuor * @link http://forum.codecall.net/topic/62457-creating-a-bmp-image-in-java/ */ import java.io.File; import java.io.FileOutputStream; public class BMP { private final static

Converting color bmp to grayscale bmp?

老子叫甜甜 提交于 2019-12-11 06:36:21
问题 I am trying to convert a colored BMP file to gray-scale BMP. The input bmp is 24 bit and I am producing the same 24 bit bmp at the output, only this time in gray-scale. The code I am using is for(int x = 0; x < max; x++) { int lum; lum = (r[x]*0.30) + (g[x]*0.59) + (b[x]*0.11); r[x] = lum; g[x] = lum; b[x] = lum; } The r , g , b arrays are the RGB color components and I have them in a char *r,*g,*b . For some reasons I am not getting a clean output. I am attaching the output I am getting with

How to Convert bmp file to pcx file [closed]

白昼怎懂夜的黑 提交于 2019-12-11 06:25:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 months ago . Any method or dll found to convert the image format bpm to pcx? I have been trying to following code. public static void ConvertBMP2PCX(string bmpFilePath) { List<byte> listBytePCX = new List<byte>(); Bitmap bmp = new Bitmap(bmpFilePath); int bmpWidth = bmp.Width; int bmpHeight = bmp.Height; byte[] byteBmp;

Java: Saving big .bmp files with FileOutputStream

[亡魂溺海] 提交于 2019-12-11 05:04:56
问题 I'm trying to write an application generating and saving high resolution images of Julia sets, but I've got a problem. My code is creating a file with size almost corresponding to what (in my opinion) it should be, but when I try to open it, there's an error message about premature end of file. I'm basically taking a size*size square, then for each pixel of this square I'm calculating corresponding number from the complex plane (fragment from -1.5 - 1.5i to 1,5 + 1.5i), and after that I'm

Build Pygame with full image support?

懵懂的女人 提交于 2019-12-11 02:53:00
问题 I'm trying to create a graphical application and using pygame as my library. However, in order to load non-bmp files I need to build python with full image support. The image module is a required dependency of Pygame, but it only optionally supports any extended file formats. By default it can only load uncompressed BMP images. When built with full image support, the pygame.image.load - load new image from a file function can support the following formats. How do I do this? 回答1: The image

libtiff error: Old-style JPEG compression support is not configured

孤街醉人 提交于 2019-12-11 02:38:36
问题 While converting TIFF to BMP using libtiff on Mac OS X, I got these errors: scannerdata.tif: Old-style JPEG compression support is not configured. scannerdata.tif: Sorry, requested compression method is not configured. I am currently using libtiff in Mac OS X. My implementation of tiff to bmp: static void tifftobmp(char *colorMode){ DBG(1, ">> tifftobmp \n"); /* For files and file header */ char infile[PATH_MAX] = {0}; char outfile[PATH_MAX] = {0}; char tempfile[PATH_MAX] = {0}; TIFF *tifFile

Convert All to JPG in C#

倾然丶 夕夏残阳落幕 提交于 2019-12-11 01:26:29
问题 I have a function like given below: // Convert To JPG // public string AlltoJPG(FileInfo foo) { // Get file extension string fileExtension = foo.Extension; // Get file name without extenstion string fileName = foo.Name.Replace(foo.Extension, string.Empty) + ".jpg"; /*------------------------------------------------------------------------*/ /// <Check for PNG File Format> if (fileExtension == ".png" || fileExtension == ".PNG") { System.Drawing.Image img = System.Drawing.Image.FromFile(foo

How do I create a bitmap using the BITMAPV5HEADER header?

六眼飞鱼酱① 提交于 2019-12-11 00:47:02
问题 This is my current code, but it causes an error when casting to BITMAPINFOHEADER: /* Create the bitmap */ BITMAPINFO bmpinfo; ZeroMemory(&bmpinfo, sizeof(bmpinfo)); BITMAPV5HEADER bmpheader; ZeroMemory(&bmpheader, sizeof(bmpheader)); bmpheader.bV5Size = sizeof(BITMAPV5HEADER); bmpheader.bV5Width = width; bmpheader.bV5Height = height; bmpheader.bV5Planes = 1; bmpheader.bV5BitCount = 32; bmpheader.bV5Compression = BI_BITFIELDS; bmpheader.bV5SizeImage = width*height*4; bmpheader.bV5RedMask =

UWP / C# Rotating BMP

倾然丶 夕夏残阳落幕 提交于 2019-12-11 00:31:21
问题 The question seems to be asked already, however I cannot find a relevant answer. I am loading a BMP image to memory in a UWP app, and I would like to rotate it by either 90, 180 or 270, but I just cannot find the way to do this. The imgSource.rotate() does not seem to exist anymore The RotateTransform works with xaml .... Could anyone add the missing code by a chance please? public async Task LoadImage() { StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync("test.bmp");